Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Count the number of tracks that are part of the rock genre. [/INST]

Output: SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId WHERE T1.Name  =  "Rock";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What is the average unit price of tracks that belong to Jazz genre? [/INST]

Output: SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId WHERE T1.Name  =  "Jazz";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the average unit price of jazz tracks. [/INST]

Output: SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId WHERE T1.Name  =  "Jazz";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What is the first name and last name of the customer that has email "luisg@embraer.com.br"? [/INST]

Output: SELECT FirstName ,  LastName FROM CUSTOMER WHERE Email  =  "luisg@embraer.com.br";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the full name of the customer with the email "luisg@embraer.com.br". [/INST]

Output: SELECT FirstName ,  LastName FROM CUSTOMER WHERE Email  =  "luisg@embraer.com.br";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: How many customers have email that contains "gmail.com"? [/INST]

Output: SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE "%gmail.com%";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Count the number of customers that have an email containing "gmail.com". [/INST]

Output: SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE "%gmail.com%";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What is the first name and last name employee helps the customer with first name Leonie? [/INST]

Output: SELECT T2.FirstName ,  T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId  =  T2.EmployeeId WHERE T1.FirstName  =  "Leonie";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the full names of employees who help customers with the first name Leonie. [/INST]

Output: SELECT T2.FirstName ,  T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId  =  T2.EmployeeId WHERE T1.FirstName  =  "Leonie";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What city does the employee who helps the customer with postal code 70174 live in? [/INST]

Output: SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId  =  T2.EmployeeId WHERE T1.PostalCode  =  "70174";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the cities corresponding to employees who help customers with the postal code 70174. [/INST]

Output: SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId  =  T2.EmployeeId WHERE T1.PostalCode  =  "70174";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: How many distinct cities does the employees live in? [/INST]

Output: SELECT COUNT(DISTINCT city) FROM EMPLOYEE;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the number of different cities that employees live in. [/INST]

Output: SELECT COUNT(DISTINCT city) FROM EMPLOYEE;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find all invoice dates corresponding to customers with first name Astrid and last name Gruber. [/INST]

Output: SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId  =  T2.CustomerId WHERE T1.FirstName  =  "Astrid" AND LastName  =  "Gruber";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the invoice dates for customers with the first name Astrid and the last name Gruber? [/INST]

Output: SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId  =  T2.CustomerId WHERE T1.FirstName  =  "Astrid" AND LastName  =  "Gruber";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find all the customer last names that do not have invoice totals larger than 20. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the last names of customers without invoice totals exceeding 20? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the first names of all customers that live in Brazil and have an invoice. [/INST]

Output: SELECT DISTINCT T1.FirstName FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId  =  T2.CustomerId WHERE T1.country  =  "Brazil";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the different first names for customers from Brazil who have also had an invoice? [/INST]

Output: SELECT DISTINCT T1.FirstName FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId  =  T2.CustomerId WHERE T1.country  =  "Brazil";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the address of all customers that live in Germany and have invoice. [/INST]

Output: SELECT DISTINCT T1.Address FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId  =  T2.CustomerId WHERE T1.country  =  "Germany";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the addresses of customers living in Germany who have had an invoice? [/INST]

Output: SELECT DISTINCT T1.Address FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId  =  T2.CustomerId WHERE T1.country  =  "Germany";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: List the phone numbers of all employees. [/INST]

Output: SELECT Phone FROM EMPLOYEE;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the phone numbers for each employee? [/INST]

Output: SELECT Phone FROM EMPLOYEE;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: How many tracks are in the AAC audio file media type? [/INST]

Output: SELECT COUNT(*) FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId  =  T2.MediaTypeId WHERE T1.Name  =  "AAC audio file";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Count the number of tracks that are of the media type "AAC audio file". [/INST]

Output: SELECT COUNT(*) FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId  =  T2.MediaTypeId WHERE T1.Name  =  "AAC audio file";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What is the average duration in milliseconds of tracks that belong to Latin or Pop genre? [/INST]

Output: SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId WHERE T1.Name  =  "Latin" OR T1.Name  =  "Pop";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the average millisecond length of Latin and Pop tracks. [/INST]

Output: SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId WHERE T1.Name  =  "Latin" OR T1.Name  =  "Pop";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Please show the employee first names and ids of employees who serve at least 10 customers. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the first names and support rep ids for employees serving 10 or more customers? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Please show the employee last names that serves no more than 20 customers. [/INST]

Output: SELECT T1.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId  =  T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*)  <=  20;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the last names of employees who serve at most 20 customers? [/INST]

Output: SELECT T1.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId  =  T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*)  <=  20;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Please list all album titles in alphabetical order. [/INST]

Output: SELECT Title FROM ALBUM ORDER BY Title;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are all the album titles, in alphabetical order? [/INST]

Output: SELECT Title FROM ALBUM ORDER BY Title;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Please list the name and id of all artists that have at least 3 albums in alphabetical order. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the names and ids of artists with 3 or more albums, listed in alphabetical order? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the names of artists that do not have any albums. [/INST]

Output: SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId  =  T2.ArtistId;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the names of artists who have not released any albums? [/INST]

Output: SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId  =  T2.ArtistId;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What is the average unit price of rock tracks? [/INST]

Output: SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId WHERE T1.Name  =  "Rock";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the average unit price of tracks from the Rock genre. [/INST]

Output: SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId WHERE T1.Name  =  "Rock";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the duration of the longest and shortest pop tracks in milliseconds? [/INST]

Output: SELECT max(Milliseconds) ,  min(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId WHERE T1.Name  =  "Pop";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the maximum and minimum millisecond lengths of pop tracks. [/INST]

Output: SELECT max(Milliseconds) ,  min(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId WHERE T1.Name  =  "Pop";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the birth dates of employees living in Edmonton? [/INST]

Output: SELECT BirthDate FROM EMPLOYEE WHERE City  =  "Edmonton";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the birth dates corresponding to employees who live in the city of Edmonton. [/INST]

Output: SELECT BirthDate FROM EMPLOYEE WHERE City  =  "Edmonton";


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: What are the distinct unit prices of all tracks? [/INST]

Output: SELECT distinct(UnitPrice) FROM TRACK;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Find the distinct unit prices for tracks. [/INST]

Output: SELECT distinct(UnitPrice) FROM TRACK;


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: How many artists do not have any album? [/INST]

Output: SELECT count(*) FROM ARTIST WHERE artistid NOT IN(SELECT artistid FROM ALBUM);


Input:
[INST] Here is a database schema:
Album :
AlbumId [ INT ] primary_key
Title [ TEXT ]
ArtistId [ INT ] Album.ArtistId = Artist.ArtistId

Artist :
ArtistId [ INT ] primary_key
Name [ TEXT ]

Customer :
CustomerId [ INT ] primary_key
FirstName [ TEXT ]
LastName [ TEXT ]
Company [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]
SupportRepId [ INT ] Customer.SupportRepId = Employee.EmployeeId

Employee :
EmployeeId [ INT ] primary_key
LastName [ TEXT ]
FirstName [ TEXT ]
Title [ TEXT ]
ReportsTo [ INT ] Employee.ReportsTo = Employee.EmployeeId
BirthDate [ TEXT ]
HireDate [ TEXT ]
Address [ TEXT ]
City [ TEXT ]
State [ TEXT ]
Country [ TEXT ]
PostalCode [ TEXT ]
Phone [ TEXT ]
Fax [ TEXT ]
Email [ TEXT ]

Genre :
GenreId [ INT ] primary_key
Name [ TEXT ]

Invoice :
InvoiceId [ INT ] primary_key
CustomerId [ INT ] Invoice.CustomerId = Customer.CustomerId
InvoiceDate [ TEXT ]
BillingAddress [ TEXT ]
BillingCity [ TEXT ]
BillingState [ TEXT ]
BillingCountry [ TEXT ]
BillingPostalCode [ TEXT ]
Total [ INT ]

InvoiceLine :
InvoiceLineId [ INT ] primary_key
InvoiceId [ INT ] InvoiceLine.InvoiceId = Invoice.InvoiceId
TrackId [ INT ] InvoiceLine.TrackId = Track.TrackId
UnitPrice [ INT ]
Quantity [ INT ]

MediaType :
MediaTypeId [ INT ] primary_key
Name [ TEXT ]

Playlist :
PlaylistId [ INT ] primary_key
Name [ TEXT ]

PlaylistTrack :
PlaylistId [ INT ] primary_key PlaylistTrack.PlaylistId = Playlist.PlaylistId
TrackId [ INT ] PlaylistTrack.TrackId = Track.TrackId

Track :
TrackId [ INT ] primary_key
Name [ TEXT ]
AlbumId [ INT ] Track.AlbumId = Album.AlbumId
MediaTypeId [ INT ] Track.MediaTypeId = MediaType.MediaTypeId
GenreId [ INT ] Track.GenreId = Genre.GenreId
Composer [ TEXT ]
Milliseconds [ INT ]
Bytes [ INT ]
UnitPrice [ INT ]

Please write me a SQL statement that answers the following question: Cound the number of artists who have not released an album. [/INST]

Output: SELECT count(*) FROM ARTIST WHERE artistid NOT IN(SELECT artistid FROM ALBUM);