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 are the minimum, maximum and average values of the ratings?
assistant
SELECT MIN( rating ) , MAX( rating ) , AVG ( rating ) FROM song;
human
Which songs have a higher rating than the average, list the song ids.
assistant
SELECT f_id FROM song WHERE rating > ( SELECT AVG ( rating ) FROM song );
human
What about the song ids 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 ) ;