db_name
stringclasses
146 values
prompt
stringlengths
310
4.81k
coffee_shop
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # shop ( Shop_ID, Address, Num_of_staff, Score, Open_Year ) # member ( Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address ) # happy_hour ( HH_ID, Shop_ID, Month, Num_of_shaff_in_charge ) # happy_hour_member ( HH_ID, Member_ID, Total_amount ) # # happy_hour.Shop_ID can be joined with shop.Shop_ID # happy_hour_member.Member_ID can be joined with member.Member_ID # ### Question: # # What are the average score and average staff number of all shops? # ### SQL: # # SELECT avg(num_of_staff) , avg(score) FROM shop # ### End.
coffee_shop
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # shop ( Shop_ID, Address, Num_of_staff, Score, Open_Year ) # member ( Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address ) # happy_hour ( HH_ID, Shop_ID, Month, Num_of_shaff_in_charge ) # happy_hour_member ( HH_ID, Member_ID, Total_amount ) # # happy_hour.Shop_ID can be joined with shop.Shop_ID # happy_hour_member.Member_ID can be joined with member.Member_ID # ### Question: # # Find the id and address of the shops whose score is below the average score. # ### SQL: # # SELECT shop_id , address FROM shop WHERE score < (SELECT avg(score) FROM shop) # ### End.
coffee_shop
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # shop ( Shop_ID, Address, Num_of_staff, Score, Open_Year ) # member ( Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address ) # happy_hour ( HH_ID, Shop_ID, Month, Num_of_shaff_in_charge ) # happy_hour_member ( HH_ID, Member_ID, Total_amount ) # # happy_hour.Shop_ID can be joined with shop.Shop_ID # happy_hour_member.Member_ID can be joined with member.Member_ID # ### Question: # # Find the address and staff number of the shops that do not have any happy hour. # ### SQL: # # SELECT address , num_of_staff FROM shop WHERE shop_id NOT IN (SELECT shop_id FROM happy_hour) # ### End.
coffee_shop
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # shop ( Shop_ID, Address, Num_of_staff, Score, Open_Year ) # member ( Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address ) # happy_hour ( HH_ID, Shop_ID, Month, Num_of_shaff_in_charge ) # happy_hour_member ( HH_ID, Member_ID, Total_amount ) # # happy_hour.Shop_ID can be joined with shop.Shop_ID # happy_hour_member.Member_ID can be joined with member.Member_ID # ### Question: # # What are the id and address of the shops which have a happy hour in May? # ### SQL: # # SELECT t1.address , t1.shop_id FROM shop AS t1 JOIN happy_hour AS t2 ON t1.shop_id = t2.shop_id WHERE MONTH = 'May' # ### End.
coffee_shop
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # shop ( Shop_ID, Address, Num_of_staff, Score, Open_Year ) # member ( Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address ) # happy_hour ( HH_ID, Shop_ID, Month, Num_of_shaff_in_charge ) # happy_hour_member ( HH_ID, Member_ID, Total_amount ) # # happy_hour.Shop_ID can be joined with shop.Shop_ID # happy_hour_member.Member_ID can be joined with member.Member_ID # ### Question: # # which shop has happy hour most frequently? List its id and number of happy hours. # ### SQL: # # SELECT shop_id , count(*) FROM happy_hour GROUP BY shop_id ORDER BY count(*) DESC LIMIT 1 # ### End.
coffee_shop
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # shop ( Shop_ID, Address, Num_of_staff, Score, Open_Year ) # member ( Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address ) # happy_hour ( HH_ID, Shop_ID, Month, Num_of_shaff_in_charge ) # happy_hour_member ( HH_ID, Member_ID, Total_amount ) # # happy_hour.Shop_ID can be joined with shop.Shop_ID # happy_hour_member.Member_ID can be joined with member.Member_ID # ### Question: # # Which month has the most happy hours? # ### SQL: # # SELECT MONTH FROM happy_hour GROUP BY MONTH ORDER BY count(*) DESC LIMIT 1 # ### End.
coffee_shop
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # shop ( Shop_ID, Address, Num_of_staff, Score, Open_Year ) # member ( Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address ) # happy_hour ( HH_ID, Shop_ID, Month, Num_of_shaff_in_charge ) # happy_hour_member ( HH_ID, Member_ID, Total_amount ) # # happy_hour.Shop_ID can be joined with shop.Shop_ID # happy_hour_member.Member_ID can be joined with member.Member_ID # ### Question: # # Which months have more than 2 happy hours? # ### SQL: # # SELECT MONTH FROM happy_hour GROUP BY MONTH HAVING count(*) > 2 # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # How many albums are there? # ### SQL: # # SELECT count(*) FROM ALBUM # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the number of albums. # ### SQL: # # SELECT count(*) FROM ALBUM # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # List the names of all music genres. # ### SQL: # # SELECT Name FROM GENRE # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the names of different music genres? # ### SQL: # # SELECT Name FROM GENRE # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find all the customer information in state NY. # ### SQL: # # SELECT * FROM CUSTOMER WHERE State = "NY" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What is all the customer information for customers in NY state? # ### SQL: # # SELECT * FROM CUSTOMER WHERE State = "NY" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the first names and last names of the employees who live in Calgary city. # ### SQL: # # SELECT FirstName , LastName FROM EMPLOYEE WHERE City = "Calgary" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the full names of employees living in the city of Calgary. # ### SQL: # # SELECT FirstName , LastName FROM EMPLOYEE WHERE City = "Calgary" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the distinct billing countries of the invoices? # ### SQL: # # SELECT distinct(BillingCountry) FROM INVOICE # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the different billing countries for all invoices. # ### SQL: # # SELECT distinct(BillingCountry) FROM INVOICE # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the names of all artists that have "a" in their names. # ### SQL: # # SELECT Name FROM ARTIST WHERE Name LIKE "%a%" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the names of artist who have the letter 'a' in their names? # ### SQL: # # SELECT Name FROM ARTIST WHERE Name LIKE "%a%" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the title of all the albums of the artist "AC/DC". # ### SQL: # # SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "AC/DC" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the titles of albums by the artist "AC/DC"? # ### SQL: # # SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "AC/DC" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Hom many albums does the artist "Metallica" have? # ### SQL: # # SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "Metallica" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the number of albums by the artist "Metallica". # ### SQL: # # SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "Metallica" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Which artist does the album "Balls to the Wall" belong to? # ### SQL: # # SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = "Balls to the Wall" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the name of the artist who made the album "Balls to the Wall". # ### SQL: # # SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = "Balls to the Wall" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Which artist has the most albums? # ### SQL: # # SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId GROUP BY T2.Name ORDER BY COUNT(*) DESC LIMIT 1 # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What is the name of the artist with the greatest number of albums? # ### SQL: # # SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId GROUP BY T2.Name ORDER BY COUNT(*) DESC LIMIT 1 # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the names of all the tracks that contain the word "you". # ### SQL: # # SELECT Name FROM TRACK WHERE Name LIKE '%you%' # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the names of tracks that contain the the word you in them? # ### SQL: # # SELECT Name FROM TRACK WHERE Name LIKE '%you%' # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What is the average unit price of all the tracks? # ### SQL: # # SELECT AVG(UnitPrice) FROM TRACK # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the average unit price for a track. # ### SQL: # # SELECT AVG(UnitPrice) FROM TRACK # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the durations of the longest and the shortest tracks in milliseconds? # ### SQL: # # SELECT max(Milliseconds) , min(Milliseconds) FROM TRACK # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the maximum and minimum durations of tracks in milliseconds. # ### SQL: # # SELECT max(Milliseconds) , min(Milliseconds) FROM TRACK # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Show the album names, ids and the number of tracks for each album. # ### SQL: # # SELECT T1.Title , T2.AlbumID , COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.AlbumID # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the names and ids of the different albums, and how many tracks are on each? # ### SQL: # # SELECT T1.Title , T2.AlbumID , COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.AlbumID # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What is the name of the most common genre in all tracks? # ### SQL: # # SELECT T1.Name FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId GROUP BY T2.GenreId ORDER BY COUNT(*) DESC LIMIT 1 # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the name of the genre that is most frequent across all tracks. # ### SQL: # # SELECT T1.Name FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId GROUP BY T2.GenreId ORDER BY COUNT(*) DESC LIMIT 1 # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What is the least common media type in all tracks? # ### SQL: # # SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) ASC LIMIT 1 # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What is the name of the media type that is least common across all tracks? # ### SQL: # # SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) ASC LIMIT 1 # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Show the album names and ids for albums that contain tracks with unit price bigger than 1. # ### SQL: # # SELECT T1.Title , T2.AlbumID FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 GROUP BY T2.AlbumID # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the titles and ids for albums containing tracks with unit price greater than 1? # ### SQL: # # SELECT T1.Title , T2.AlbumID FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 GROUP BY T2.AlbumID # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # How many tracks belong to rock genre? # ### SQL: # # SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Count the number of tracks that are part of the rock genre. # ### SQL: # # SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What is the average unit price of tracks that belong to Jazz genre? # ### SQL: # # SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Jazz" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the average unit price of jazz tracks. # ### SQL: # # SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Jazz" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What is the first name and last name of the customer that has email "luisg@embraer.com.br"? # ### SQL: # # SELECT FirstName , LastName FROM CUSTOMER WHERE Email = "luisg@embraer.com.br" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the full name of the customer with the email "luisg@embraer.com.br". # ### SQL: # # SELECT FirstName , LastName FROM CUSTOMER WHERE Email = "luisg@embraer.com.br" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # How many customers have email that contains "gmail.com"? # ### SQL: # # SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE "%gmail.com%" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Count the number of customers that have an email containing "gmail.com". # ### SQL: # # SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE "%gmail.com%" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What is the first name and last name employee helps the customer with first name Leonie? # ### SQL: # # SELECT T2.FirstName , T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = "Leonie" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the full names of employees who help customers with the first name Leonie. # ### SQL: # # SELECT T2.FirstName , T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = "Leonie" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What city does the employee who helps the customer with postal code 70174 live in? # ### SQL: # # SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = "70174" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the cities corresponding to employees who help customers with the postal code 70174. # ### SQL: # # SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = "70174" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # How many distinct cities does the employees live in? # ### SQL: # # SELECT COUNT(DISTINCT city) FROM EMPLOYEE # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the number of different cities that employees live in. # ### SQL: # # SELECT COUNT(DISTINCT city) FROM EMPLOYEE # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find all invoice dates corresponding to customers with first name Astrid and last name Gruber. # ### SQL: # # SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = "Astrid" AND LastName = "Gruber" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the invoice dates for customers with the first name Astrid and the last name Gruber? # ### SQL: # # SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = "Astrid" AND LastName = "Gruber" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find all the customer last names that do not have invoice totals larger than 20. # ### SQL: # # SELECT LastName FROM CUSTOMER EXCEPT SELECT T1.LastName FROM CUSTOMER AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T2.total > 20 # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the last names of customers without invoice totals exceeding 20? # ### SQL: # # SELECT LastName FROM CUSTOMER EXCEPT SELECT T1.LastName FROM CUSTOMER AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T2.total > 20 # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the first names of all customers that live in Brazil and have an invoice. # ### SQL: # # SELECT DISTINCT T1.FirstName FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "Brazil" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the different first names for customers from Brazil who have also had an invoice? # ### SQL: # # SELECT DISTINCT T1.FirstName FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "Brazil" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the address of all customers that live in Germany and have invoice. # ### SQL: # # SELECT DISTINCT T1.Address FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "Germany" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the addresses of customers living in Germany who have had an invoice? # ### SQL: # # SELECT DISTINCT T1.Address FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "Germany" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # List the phone numbers of all employees. # ### SQL: # # SELECT Phone FROM EMPLOYEE # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the phone numbers for each employee? # ### SQL: # # SELECT Phone FROM EMPLOYEE # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # How many tracks are in the AAC audio file media type? # ### SQL: # # SELECT COUNT(*) FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId WHERE T1.Name = "AAC audio file" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Count the number of tracks that are of the media type "AAC audio file". # ### SQL: # # SELECT COUNT(*) FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId WHERE T1.Name = "AAC audio file" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What is the average duration in milliseconds of tracks that belong to Latin or Pop genre? # ### SQL: # # SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Latin" OR T1.Name = "Pop" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the average millisecond length of Latin and Pop tracks. # ### SQL: # # SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Latin" OR T1.Name = "Pop" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Please show the employee first names and ids of employees who serve at least 10 customers. # ### SQL: # # SELECT T1.FirstName , T1.SupportRepId FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) >= 10 # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the first names and support rep ids for employees serving 10 or more customers? # ### SQL: # # SELECT T1.FirstName , T1.SupportRepId FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) >= 10 # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Please show the employee last names that serves no more than 20 customers. # ### SQL: # # SELECT T1.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) <= 20 # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the last names of employees who serve at most 20 customers? # ### SQL: # # SELECT T1.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) <= 20 # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Please list all album titles in alphabetical order. # ### SQL: # # SELECT Title FROM ALBUM ORDER BY Title # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are all the album titles, in alphabetical order? # ### SQL: # # SELECT Title FROM ALBUM ORDER BY Title # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Please list the name and id of all artists that have at least 3 albums in alphabetical order. # ### SQL: # # SELECT T2.Name , T1.ArtistId FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistID GROUP BY T1.ArtistId HAVING COUNT(*) >= 3 ORDER BY T2.Name # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the names and ids of artists with 3 or more albums, listed in alphabetical order? # ### SQL: # # SELECT T2.Name , T1.ArtistId FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistID GROUP BY T1.ArtistId HAVING COUNT(*) >= 3 ORDER BY T2.Name # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the names of artists that do not have any albums. # ### SQL: # # SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the names of artists who have not released any albums? # ### SQL: # # SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What is the average unit price of rock tracks? # ### SQL: # # SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the average unit price of tracks from the Rock genre. # ### SQL: # # SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the duration of the longest and shortest pop tracks in milliseconds? # ### SQL: # # SELECT max(Milliseconds) , min(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Pop" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the maximum and minimum millisecond lengths of pop tracks. # ### SQL: # # SELECT max(Milliseconds) , min(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Pop" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the birth dates of employees living in Edmonton? # ### SQL: # # SELECT BirthDate FROM EMPLOYEE WHERE City = "Edmonton" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the birth dates corresponding to employees who live in the city of Edmonton. # ### SQL: # # SELECT BirthDate FROM EMPLOYEE WHERE City = "Edmonton" # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the distinct unit prices of all tracks? # ### SQL: # # SELECT distinct(UnitPrice) FROM TRACK # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the distinct unit prices for tracks. # ### SQL: # # SELECT distinct(UnitPrice) FROM TRACK # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # How many artists do not have any album? # ### SQL: # # SELECT count(*) FROM ARTIST WHERE artistid NOT IN(SELECT artistid FROM ALBUM) # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Cound the number of artists who have not released an album. # ### SQL: # # SELECT count(*) FROM ARTIST WHERE artistid NOT IN(SELECT artistid FROM ALBUM) # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # What are the album titles for albums containing both 'Reggae' and 'Rock' genre tracks? # ### SQL: # # SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Reggae' INTERSECT SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Rock' # ### End.
chinook_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 ) # # Album.ArtistId can be joined with Artist.ArtistId # Customer.SupportRepId can be joined with Employee.EmployeeId # Employee.ReportsTo can be joined with Employee.EmployeeId # Invoice.CustomerId can be joined with Customer.CustomerId # InvoiceLine.TrackId can be joined with Track.TrackId # InvoiceLine.InvoiceId can be joined with Invoice.InvoiceId # PlaylistTrack.TrackId can be joined with Track.TrackId # PlaylistTrack.PlaylistId can be joined with Playlist.PlaylistId # Track.MediaTypeId can be joined with MediaType.MediaTypeId # Track.GenreId can be joined with Genre.GenreId # Track.AlbumId can be joined with Album.AlbumId # ### Question: # # Find the titles of albums that contain tracks of both the Reggae and Rock genres. # ### SQL: # # SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Reggae' INTERSECT SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Rock' # ### End.
insurance_fnol
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( Customer_ID, Customer_name ) # Services ( Service_ID, Service_name ) # Available_Policies ( Policy_ID, policy_type_code, Customer_Phone ) # Customers_Policies ( Customer_ID, Policy_ID, Date_Opened, Date_Closed ) # First_Notification_of_Loss ( FNOL_ID, Customer_ID, Policy_ID, Service_ID ) # Claims ( Claim_ID, FNOL_ID, Effective_Date ) # Settlements ( Settlement_ID, Claim_ID, Effective_Date, Settlement_Amount ) # # Customers_Policies.Policy_ID can be joined with Available_Policies.Policy_ID # Customers_Policies.Customer_ID can be joined with Customers.Customer_ID # First_Notification_of_Loss.Customer_ID can be joined with Customers_Policies.Customer_ID # First_Notification_of_Loss.Policy_ID can be joined with Customers_Policies.Policy_ID # First_Notification_of_Loss.Service_ID can be joined with Services.Service_ID # Claims.FNOL_ID can be joined with First_Notification_of_Loss.FNOL_ID # Settlements.Claim_ID can be joined with Claims.Claim_ID # ### Question: # # Find all the phone numbers. # ### SQL: # # SELECT customer_phone FROM available_policies # ### End.
insurance_fnol
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( Customer_ID, Customer_name ) # Services ( Service_ID, Service_name ) # Available_Policies ( Policy_ID, policy_type_code, Customer_Phone ) # Customers_Policies ( Customer_ID, Policy_ID, Date_Opened, Date_Closed ) # First_Notification_of_Loss ( FNOL_ID, Customer_ID, Policy_ID, Service_ID ) # Claims ( Claim_ID, FNOL_ID, Effective_Date ) # Settlements ( Settlement_ID, Claim_ID, Effective_Date, Settlement_Amount ) # # Customers_Policies.Policy_ID can be joined with Available_Policies.Policy_ID # Customers_Policies.Customer_ID can be joined with Customers.Customer_ID # First_Notification_of_Loss.Customer_ID can be joined with Customers_Policies.Customer_ID # First_Notification_of_Loss.Policy_ID can be joined with Customers_Policies.Policy_ID # First_Notification_of_Loss.Service_ID can be joined with Services.Service_ID # Claims.FNOL_ID can be joined with First_Notification_of_Loss.FNOL_ID # Settlements.Claim_ID can be joined with Claims.Claim_ID # ### Question: # # What are all the phone numbers? # ### SQL: # # SELECT customer_phone FROM available_policies # ### End.
insurance_fnol
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( Customer_ID, Customer_name ) # Services ( Service_ID, Service_name ) # Available_Policies ( Policy_ID, policy_type_code, Customer_Phone ) # Customers_Policies ( Customer_ID, Policy_ID, Date_Opened, Date_Closed ) # First_Notification_of_Loss ( FNOL_ID, Customer_ID, Policy_ID, Service_ID ) # Claims ( Claim_ID, FNOL_ID, Effective_Date ) # Settlements ( Settlement_ID, Claim_ID, Effective_Date, Settlement_Amount ) # # Customers_Policies.Policy_ID can be joined with Available_Policies.Policy_ID # Customers_Policies.Customer_ID can be joined with Customers.Customer_ID # First_Notification_of_Loss.Customer_ID can be joined with Customers_Policies.Customer_ID # First_Notification_of_Loss.Policy_ID can be joined with Customers_Policies.Policy_ID # First_Notification_of_Loss.Service_ID can be joined with Services.Service_ID # Claims.FNOL_ID can be joined with First_Notification_of_Loss.FNOL_ID # Settlements.Claim_ID can be joined with Claims.Claim_ID # ### Question: # # What are the customer phone numbers under the policy "Life Insurance"? # ### SQL: # # SELECT customer_phone FROM available_policies WHERE policy_type_code = "Life Insurance" # ### End.
insurance_fnol
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( Customer_ID, Customer_name ) # Services ( Service_ID, Service_name ) # Available_Policies ( Policy_ID, policy_type_code, Customer_Phone ) # Customers_Policies ( Customer_ID, Policy_ID, Date_Opened, Date_Closed ) # First_Notification_of_Loss ( FNOL_ID, Customer_ID, Policy_ID, Service_ID ) # Claims ( Claim_ID, FNOL_ID, Effective_Date ) # Settlements ( Settlement_ID, Claim_ID, Effective_Date, Settlement_Amount ) # # Customers_Policies.Policy_ID can be joined with Available_Policies.Policy_ID # Customers_Policies.Customer_ID can be joined with Customers.Customer_ID # First_Notification_of_Loss.Customer_ID can be joined with Customers_Policies.Customer_ID # First_Notification_of_Loss.Policy_ID can be joined with Customers_Policies.Policy_ID # First_Notification_of_Loss.Service_ID can be joined with Services.Service_ID # Claims.FNOL_ID can be joined with First_Notification_of_Loss.FNOL_ID # Settlements.Claim_ID can be joined with Claims.Claim_ID # ### Question: # # What are the phone numbers of customers using the policy with the code "Life Insurance"? # ### SQL: # # SELECT customer_phone FROM available_policies WHERE policy_type_code = "Life Insurance" # ### End.
insurance_fnol
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( Customer_ID, Customer_name ) # Services ( Service_ID, Service_name ) # Available_Policies ( Policy_ID, policy_type_code, Customer_Phone ) # Customers_Policies ( Customer_ID, Policy_ID, Date_Opened, Date_Closed ) # First_Notification_of_Loss ( FNOL_ID, Customer_ID, Policy_ID, Service_ID ) # Claims ( Claim_ID, FNOL_ID, Effective_Date ) # Settlements ( Settlement_ID, Claim_ID, Effective_Date, Settlement_Amount ) # # Customers_Policies.Policy_ID can be joined with Available_Policies.Policy_ID # Customers_Policies.Customer_ID can be joined with Customers.Customer_ID # First_Notification_of_Loss.Customer_ID can be joined with Customers_Policies.Customer_ID # First_Notification_of_Loss.Policy_ID can be joined with Customers_Policies.Policy_ID # First_Notification_of_Loss.Service_ID can be joined with Services.Service_ID # Claims.FNOL_ID can be joined with First_Notification_of_Loss.FNOL_ID # Settlements.Claim_ID can be joined with Claims.Claim_ID # ### Question: # # Which policy type has the most records in the database? # ### SQL: # # SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1 # ### End.
insurance_fnol
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( Customer_ID, Customer_name ) # Services ( Service_ID, Service_name ) # Available_Policies ( Policy_ID, policy_type_code, Customer_Phone ) # Customers_Policies ( Customer_ID, Policy_ID, Date_Opened, Date_Closed ) # First_Notification_of_Loss ( FNOL_ID, Customer_ID, Policy_ID, Service_ID ) # Claims ( Claim_ID, FNOL_ID, Effective_Date ) # Settlements ( Settlement_ID, Claim_ID, Effective_Date, Settlement_Amount ) # # Customers_Policies.Policy_ID can be joined with Available_Policies.Policy_ID # Customers_Policies.Customer_ID can be joined with Customers.Customer_ID # First_Notification_of_Loss.Customer_ID can be joined with Customers_Policies.Customer_ID # First_Notification_of_Loss.Policy_ID can be joined with Customers_Policies.Policy_ID # First_Notification_of_Loss.Service_ID can be joined with Services.Service_ID # Claims.FNOL_ID can be joined with First_Notification_of_Loss.FNOL_ID # Settlements.Claim_ID can be joined with Claims.Claim_ID # ### Question: # # Which policy type appears most frequently in the available policies? # ### SQL: # # SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1 # ### End.
insurance_fnol
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( Customer_ID, Customer_name ) # Services ( Service_ID, Service_name ) # Available_Policies ( Policy_ID, policy_type_code, Customer_Phone ) # Customers_Policies ( Customer_ID, Policy_ID, Date_Opened, Date_Closed ) # First_Notification_of_Loss ( FNOL_ID, Customer_ID, Policy_ID, Service_ID ) # Claims ( Claim_ID, FNOL_ID, Effective_Date ) # Settlements ( Settlement_ID, Claim_ID, Effective_Date, Settlement_Amount ) # # Customers_Policies.Policy_ID can be joined with Available_Policies.Policy_ID # Customers_Policies.Customer_ID can be joined with Customers.Customer_ID # First_Notification_of_Loss.Customer_ID can be joined with Customers_Policies.Customer_ID # First_Notification_of_Loss.Policy_ID can be joined with Customers_Policies.Policy_ID # First_Notification_of_Loss.Service_ID can be joined with Services.Service_ID # Claims.FNOL_ID can be joined with First_Notification_of_Loss.FNOL_ID # Settlements.Claim_ID can be joined with Claims.Claim_ID # ### Question: # # What are all the customer phone numbers under the most popular policy type? # ### SQL: # # SELECT customer_phone FROM available_policies WHERE policy_type_code = (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1) # ### End.
insurance_fnol
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( Customer_ID, Customer_name ) # Services ( Service_ID, Service_name ) # Available_Policies ( Policy_ID, policy_type_code, Customer_Phone ) # Customers_Policies ( Customer_ID, Policy_ID, Date_Opened, Date_Closed ) # First_Notification_of_Loss ( FNOL_ID, Customer_ID, Policy_ID, Service_ID ) # Claims ( Claim_ID, FNOL_ID, Effective_Date ) # Settlements ( Settlement_ID, Claim_ID, Effective_Date, Settlement_Amount ) # # Customers_Policies.Policy_ID can be joined with Available_Policies.Policy_ID # Customers_Policies.Customer_ID can be joined with Customers.Customer_ID # First_Notification_of_Loss.Customer_ID can be joined with Customers_Policies.Customer_ID # First_Notification_of_Loss.Policy_ID can be joined with Customers_Policies.Policy_ID # First_Notification_of_Loss.Service_ID can be joined with Services.Service_ID # Claims.FNOL_ID can be joined with First_Notification_of_Loss.FNOL_ID # Settlements.Claim_ID can be joined with Claims.Claim_ID # ### Question: # # Find the phone numbers of customers using the most common policy type among the available policies. # ### SQL: # # SELECT customer_phone FROM available_policies WHERE policy_type_code = (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1) # ### End.
insurance_fnol
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( Customer_ID, Customer_name ) # Services ( Service_ID, Service_name ) # Available_Policies ( Policy_ID, policy_type_code, Customer_Phone ) # Customers_Policies ( Customer_ID, Policy_ID, Date_Opened, Date_Closed ) # First_Notification_of_Loss ( FNOL_ID, Customer_ID, Policy_ID, Service_ID ) # Claims ( Claim_ID, FNOL_ID, Effective_Date ) # Settlements ( Settlement_ID, Claim_ID, Effective_Date, Settlement_Amount ) # # Customers_Policies.Policy_ID can be joined with Available_Policies.Policy_ID # Customers_Policies.Customer_ID can be joined with Customers.Customer_ID # First_Notification_of_Loss.Customer_ID can be joined with Customers_Policies.Customer_ID # First_Notification_of_Loss.Policy_ID can be joined with Customers_Policies.Policy_ID # First_Notification_of_Loss.Service_ID can be joined with Services.Service_ID # Claims.FNOL_ID can be joined with First_Notification_of_Loss.FNOL_ID # Settlements.Claim_ID can be joined with Claims.Claim_ID # ### Question: # # Find the policy type used by more than 4 customers. # ### SQL: # # SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING count(*) > 4 # ### End.