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
How many genres are there in total?
assistant
SELECT COUNT( DISTINCT genre_is ) FROM song;
human
How many songs for each of them, show the result in the order of genre?
assistant
SELECT genre_is , COUNT( * ) FROM song GROUP BY genre_is;
human
What are the shortest duration and lowest rating for each group?
assistant
SELECT MIN( T1.duration ) , MIN( T2.rating ) , T2.genre_is FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.genre_is ORDER BY T2.genre_is ;