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