human
Schema:
Album (AlbumId, Title, ArtistId)
Artist (ArtistId, Name)
Customer (CustomerId, FirstName, LastName, Company, Address, City, State, Country, PostalCode, Phone, Fax, Email, SupportRepId)
Employee (EmployeeId, LastName, FirstName, Title, ReportsTo, BirthDate, HireDate, Address, City, State, Country, PostalCode, Phone, Fax, Email)
Genre (GenreId, Name)
Invoice (InvoiceId, CustomerId, InvoiceDate, BillingAddress, BillingCity, BillingState, BillingCountry, BillingPostalCode, Total)
InvoiceLine (InvoiceLineId, InvoiceId, TrackId, UnitPrice, Quantity)
MediaType (MediaTypeId, Name)
Playlist (PlaylistId, Name)
PlaylistTrack (PlaylistId, TrackId)
Track (TrackId, Name, AlbumId, MediaTypeId, GenreId, Composer, Milliseconds, Bytes, UnitPrice)
Please answer with SQL.
assistant
Sure, I understand.
human
How many artists have album?
assistant
SELECT COUNT( distinct artistid ) FROM ALBUM;
human
Find the album id of accept? | The album ids of the artist named 'Accept' are 2 and 3. | How many artists in this table?
assistant
SELECT COUNT( distinct t1.ArtistId ) FROM ARTIST AS t1 JOIN ALBUM AS t2 ON t1.artistid = t2.artistid WHERE t1.name = 'Accept';
human
How many albums in this table? | did you mean the number of all the albums shown in the table? | Yes.
assistant
SELECT COUNT( * ) FROM ALBUM ;