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
What is the average duration of songs that have mp3 format and resolution below 800?
assistant
SELECT avg(T1.duration) FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = 'mp3' AND T2.resolution < 800
human
What is ids of the songs whose resolution is higher than the resolution of any songs with rating lower than 8?
assistant
SELECT f_id FROM song WHERE resolution > (SELECT max(resolution) FROM song WHERE rating < 8)
human
What is ids of the songs whose resolution is higher than the average resolution of songs in modern genre?
assistant
SELECT f_id FROM song WHERE resolution > (SELECT avg(resolution) FROM song WHERE genre_is = 'modern')
human
What is the average rating of songs produced by female artists?
assistant
SELECT avg(T2.rating) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.gender = 'Female'
human
What is the average rating of songs for each language?
assistant
SELECT avg(rating) , languages FROM song GROUP BY languages
human
What is the average rating and resolution of all bangla songs?
assistant
SELECT avg ( rating ) , avg ( resolution ) FROM song WHERE languages = "bangla" ;