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
For each file format, return the number of artists who released songs in that format.
assistant
SELECT count(*) , formats FROM files GROUP BY formats
human
Find the id of songs that are available in mp4 format and have resolution lower than 1000.
assistant
SELECT f_id FROM files WHERE formats = 'mp4' INTERSECT SELECT f_id FROM song WHERE resolution < 1000
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 ids of songs that are available in either mp4 format or have resolution above 720?
assistant
SELECT f_id FROM files WHERE formats = 'mp4' UNION SELECT f_id FROM song WHERE resolution > 720
human
Return the names of songs for which format is mp3 and resolution is below 1000.
assistant
SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = 'mp3' INTERSECT SELECT song_name FROM song WHERE resolution < 1000
human
What are the id of songs whose format is mp3.
assistant
SELECT f_id FROM files WHERE formats = "mp3" ;