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 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
Find the names of the artists who are from UK and have produced English songs.
assistant
SELECT artist_name FROM artist WHERE country = 'UK' INTERSECT SELECT artist_name FROM song WHERE languages = 'english'
human
Find the names of the artists who are from Bangladesh and have never received rating higher than 7.
assistant
SELECT DISTINCT artist_name FROM artist WHERE country = 'Bangladesh' EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 7
human
Find the names and number of works of all artists who have at least one English songs.
assistant
SELECT T1.artist_name , count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = 'english' GROUP BY T2.artist_name HAVING count(*) >= 1
human
Find the names of the artists who have produced English songs but have never received rating higher than 8.
assistant
SELECT DISTINCT artist_name FROM song WHERE languages = "english" EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 8 ;