human
Schema:
genre (g_name, rating, most_popular_in)
artist (artist_name, country, gender, preferred_genre)
files (f_id, artist_name, file_size, duration, formats)
song (song_name, artist_name, country, f_id, genre_is, rating, languages, releasedate, resolution)
Please answer with SQL.
assistant
Sure, I understand.
human
Return the gender and name of artist who produced the song with the lowest resolution.
assistant
SELECT T1.gender , T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name ORDER BY T2.resolution LIMIT 1
human
How many songs have 4 minute duration?
assistant
SELECT count(*) FROM files WHERE duration LIKE '4:%'
human
List the names of all songs that have 4 minute duration or are in English.
assistant
SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.duration LIKE '4:%' UNION SELECT song_name FROM song WHERE languages = 'english'
human
What is the id of the longest song?
assistant
SELECT f_id FROM files ORDER BY duration DESC LIMIT 1
human
Find the country of origin for the artist who made the least number of songs?
assistant
SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) LIMIT 1
human
What are the names of the artists who sang the shortest song?
assistant
SELECT T1.artist_name FROM song AS T1 JOIN files AS T2 ON T1.f_id = T2.f_id ORDER BY T2.duration LIMIT 1 ;