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
Find the names and number of works of the three artists who have produced the most songs.
assistant
SELECT T1.artist_name , count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 3
human
Give me a list of the names of all songs ordered by their resolution.
assistant
SELECT song_name FROM song ORDER BY resolution
human
How many songs have 4 minute duration?
assistant
SELECT count(*) FROM files WHERE duration LIKE '4:%'
human
List the duration, file size and format of songs whose genre is pop, ordered by title?
assistant
SELECT T1.duration , T1.file_size , T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.genre_is = 'pop' ORDER BY T2.song_name
human
What are the id of songs whose format is mp3.
assistant
SELECT f_id FROM files WHERE formats = 'mp3'
human
How many songs were released for each format?
assistant
SELECT COUNT( * ) , formats FROM files GROUP BY formats ;