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 name and gender for all artists who released songs in March.
assistant
SELECT T1.artist_name , T1.gender FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.releasedate LIKE '%Mar%'
human
Find the names and number of works of the three artists who have produced the most songs.
assistant
SELECT T1.artist_name , count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 3
human
How many artists are from Bangladesh?
assistant
SELECT count(*) FROM artist WHERE country = 'Bangladesh'
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 are the names of artists who are Male and are from UK?
assistant
SELECT artist_name FROM artist WHERE country = 'UK' AND gender = 'Male'
human
What is the number of artists for each gender?
assistant
SELECT COUNT( * ) , gender FROM artist GROUP BY gender ;