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
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
List the id, genre and artist name of English songs ordered by rating.
assistant
SELECT f_id , genre_is , artist_name FROM song WHERE languages = 'english' ORDER BY rating
human
What are the names of the songs whose rating is below the rating of all songs in English?
assistant
SELECT song_name FROM song WHERE rating < (SELECT min(rating) FROM song WHERE languages = 'english')
human
List the names of all genres in alphabetical oder, together with its ratings.
assistant
SELECT g_name , rating FROM genre ORDER BY g_name
human
What are the names of all songs that have a lower rating than some song of blues genre?
assistant
SELECT song_name FROM song WHERE rating < (SELECT max(rating) FROM song WHERE genre_is = 'blues')
human
What is the shortest and most poorly rated song for each genre, ordered alphabetically by genre?
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 ;