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
What are the distinct unit prices of all tracks?
assistant
SELECT distinct(UnitPrice) FROM TRACK
human
What is the average unit price of all the tracks?
assistant
SELECT AVG(UnitPrice) FROM TRACK
human
Find the names of all the tracks that contain the word 'you'.
assistant
SELECT Name FROM TRACK WHERE Name LIKE '%you%'
human
What is the average duration in milliseconds of tracks that belong to Latin or Pop genre?
assistant
SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Latin' OR T1.Name = 'Pop'
human
What are the duration of the longest and shortest pop tracks in milliseconds?
assistant
SELECT max(Milliseconds) , min(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Pop'
human
Find the maximum and minimum durations of tracks in milliseconds.
assistant
SELECT MAX( Milliseconds ) , MIN( Milliseconds ) FROM TRACK ;