human
Schema:
Songs (SongId, Title)
Albums (AId, Title, Year, Label, Type)
Band (Id, Firstname, Lastname)
Instruments (SongId, BandmateId, Instrument)
Performance (SongId, Bandmate, StagePosition)
Tracklists (AlbumId, Position, SongId)
Vocals (SongId, Bandmate, Type)
Please answer with SQL.
assistant
Sure, I understand.
human
What is the last name of the musician that have produced the most number of songs?
assistant
SELECT T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId GROUP BY lastname ORDER BY count(*) DESC LIMIT 1
human
How many unique labels are there for albums?
assistant
SELECT count(DISTINCT label) FROM albums
human
What is the label that has the most albums?
assistant
SELECT label FROM albums GROUP BY label ORDER BY count(*) DESC LIMIT 1
human
What are the albums produced in year 2010?
assistant
SELECT * FROM Albums WHERE YEAR = 2010
human
How many songs are there?
assistant
SELECT count(*) FROM Songs
human
How many songs appear in studio albums?
assistant
SELECT COUNT( DISTINCT T3.title ) FROM albums AS T1 JOIN tracklists AS T2 ON T1.aid = T2.albumid JOIN songs AS T3 ON T2.songid = T3.songid WHERE t1.type = "Studio" ;