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 album titles for albums containing both 'Reggae' and 'Rock' genre tracks? [/INST]

Output: SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId  =  T2.AlbumId JOIN Genre AS T3 ON T2.GenreID  =  T3.GenreID WHERE T3.Name  =  'Reggae' INTERSECT SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId  =  T2.AlbumId JOIN Genre AS T3 ON T2.GenreID  =  T3.GenreID WHERE T3.Name  =  'Rock';


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 titles of albums that contain tracks of both the Reggae and Rock genres. [/INST]

Output: SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId  =  T2.AlbumId JOIN Genre AS T3 ON T2.GenreID  =  T3.GenreID WHERE T3.Name  =  'Reggae' INTERSECT SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId  =  T2.AlbumId JOIN Genre AS T3 ON T2.GenreID  =  T3.GenreID WHERE T3.Name  =  'Rock';


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

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

Output: SELECT customer_phone FROM available_policies;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

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

Output: SELECT customer_phone FROM available_policies;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: What are the customer phone numbers under the policy "Life Insurance"? [/INST]

Output: SELECT customer_phone FROM available_policies WHERE policy_type_code  =  "Life Insurance";


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: What are the phone numbers of customers using the policy with the code "Life Insurance"? [/INST]

Output: SELECT customer_phone FROM available_policies WHERE policy_type_code  =  "Life Insurance";


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Which policy type has the most records in the database? [/INST]

Output: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Which policy type appears most frequently in the available policies? [/INST]

Output: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: What are all the customer phone numbers under the most popular policy type? [/INST]

Output: SELECT customer_phone FROM available_policies WHERE policy_type_code  =  (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1);


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Find the phone numbers of customers using the most common policy type among the available policies. [/INST]

Output: SELECT customer_phone FROM available_policies WHERE policy_type_code  =  (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1);


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Find the policy type used by more than 4 customers. [/INST]

Output: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING count(*)  >  4;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Find the policy types more than 4 customers use. Show their type code. [/INST]

Output: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING count(*)  >  4;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Find the total and average amount of settlements. [/INST]

Output: SELECT sum(settlement_amount) ,  avg(settlement_amount) FROM settlements;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Return the sum and average of all settlement amounts. [/INST]

Output: SELECT sum(settlement_amount) ,  avg(settlement_amount) FROM settlements;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Find the name of services that have been used for more than 2 times in first notification of loss. [/INST]

Output: SELECT t2.service_name FROM first_notification_of_loss AS t1 JOIN services AS t2 ON t1.service_id  =  t2.service_id GROUP BY t1.service_id HAVING count(*)  >  2;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Which services have been used more than twice in first notification of loss? Return the service name. [/INST]

Output: SELECT t2.service_name FROM first_notification_of_loss AS t1 JOIN services AS t2 ON t1.service_id  =  t2.service_id GROUP BY t1.service_id HAVING count(*)  >  2;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: What is the effective date of the claim that has the largest amount of total settlement? [/INST]

Output: SELECT t1.Effective_Date FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id  =  t2.claim_id GROUP BY t1.claim_id ORDER BY sum(t2.settlement_amount) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Find the claim that has the largest total settlement amount. Return the effective date of the claim. [/INST]

Output: SELECT t1.Effective_Date FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id  =  t2.claim_id GROUP BY t1.claim_id ORDER BY sum(t2.settlement_amount) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: How many policies are listed for the customer named "Dayana Robel"? [/INST]

Output: SELECT count(*) FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.customer_name  =  "Dayana Robel";


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Count the total number of policies used by the customer named "Dayana Robel". [/INST]

Output: SELECT count(*) FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.customer_name  =  "Dayana Robel";


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: What is the name of the customer who has the most policies listed? [/INST]

Output: SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id  =  t2.customer_id GROUP BY t1.customer_name ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Which customer uses the most policies? Give me the customer name. [/INST]

Output: SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id  =  t2.customer_id GROUP BY t1.customer_name ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: What are all the policy types of the customer named "Dayana Robel"? [/INST]

Output: SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id  =  t2.customer_id JOIN available_policies AS t3 ON t2.policy_id  =  t3.policy_id WHERE t1.customer_name  =  "Dayana Robel";


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Tell me the types of the policy used by the customer named "Dayana Robel". [/INST]

Output: SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id  =  t2.customer_id JOIN available_policies AS t3 ON t2.policy_id  =  t3.policy_id WHERE t1.customer_name  =  "Dayana Robel";


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: What are all the policy types of the customer that has the most policies listed? [/INST]

Output: SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id  =  t2.customer_id JOIN available_policies AS t3 ON t2.policy_id  =  t3.policy_id WHERE t1.customer_name  =  (SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id  =  t2.customer_id GROUP BY t1.customer_name ORDER BY count(*) DESC LIMIT 1);


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: List all the policy types used by the customer enrolled in the most policies. [/INST]

Output: SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id  =  t2.customer_id JOIN available_policies AS t3 ON t2.policy_id  =  t3.policy_id WHERE t1.customer_name  =  (SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id  =  t2.customer_id GROUP BY t1.customer_name ORDER BY count(*) DESC LIMIT 1);


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

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

Output: SELECT service_name FROM services ORDER BY service_name;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Give me a list of all the service names sorted alphabetically. [/INST]

Output: SELECT service_name FROM services ORDER BY service_name;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: How many services are there? [/INST]

Output: SELECT count(*) FROM services;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Count the total number of available services. [/INST]

Output: SELECT count(*) FROM services;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Find the names of users who do not have a first notification of loss record. [/INST]

Output: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id  =  t2.customer_id;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Which customers do not have a first notification of loss record? Give me the customer names. [/INST]

Output: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id  =  t2.customer_id;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Find the names of customers who have used either the service "Close a policy" or the service "Upgrade a policy". [/INST]

Output: SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id  =  t2.customer_id JOIN services AS t3 ON t2.service_id  =  t3.service_id WHERE t3.service_name  =  "Close a policy" OR t3.service_name  =  "Upgrade a policy";


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Which customers have used the service named "Close a policy" or "Upgrade a policy"? Give me the customer names. [/INST]

Output: SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id  =  t2.customer_id JOIN services AS t3 ON t2.service_id  =  t3.service_id WHERE t3.service_name  =  "Close a policy" OR t3.service_name  =  "Upgrade a policy";


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Find the names of customers who have used both the service "Close a policy" and the service "New policy application". [/INST]

Output: SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id  =  t2.customer_id JOIN services AS t3 ON t2.service_id  =  t3.service_id WHERE t3.service_name  =  "Close a policy" INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id  =  t2.customer_id JOIN services AS t3 ON t2.service_id  =  t3.service_id WHERE t3.service_name  =  "New policy application";


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Which customers have used both the service named "Close a policy" and the service named "Upgrade a policy"? Give me the customer names. [/INST]

Output: SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id  =  t2.customer_id JOIN services AS t3 ON t2.service_id  =  t3.service_id WHERE t3.service_name  =  "Close a policy" INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id  =  t2.customer_id JOIN services AS t3 ON t2.service_id  =  t3.service_id WHERE t3.service_name  =  "New policy application";


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Find the IDs of customers whose name contains "Diana". [/INST]

Output: SELECT customer_id FROM customers WHERE customer_name LIKE "%Diana%";


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: What are the IDs of customers who have "Diana" in part of their names? [/INST]

Output: SELECT customer_id FROM customers WHERE customer_name LIKE "%Diana%";


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: What are the maximum and minimum settlement amount on record? [/INST]

Output: SELECT max(settlement_amount) ,  min(settlement_amount) FROM settlements;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Find the maximum and minimum settlement amount. [/INST]

Output: SELECT max(settlement_amount) ,  min(settlement_amount) FROM settlements;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: List all the customers in increasing order of IDs. [/INST]

Output: SELECT customer_id ,  customer_name FROM customers ORDER BY customer_id ASC;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: What is the ordered list of customer ids? [/INST]

Output: SELECT customer_id ,  customer_name FROM customers ORDER BY customer_id ASC;


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: Retrieve the open and close dates of all the policies associated with the customer whose name contains "Diana" [/INST]

Output: SELECT t2.date_opened ,  t2.date_closed FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.customer_name LIKE "%Diana%";


Input:
[INST] Here is a database schema:
Customers :
Customer_ID [ INT ] primary_key
Customer_name [ TEXT ]

Services :
Service_ID [ INT ] primary_key
Service_name [ TEXT ]

Available_Policies :
Policy_ID [ INT ] primary_key
policy_type_code [ TEXT ]
Customer_Phone [ TEXT ]

Customers_Policies :
Customer_ID [ INT ] primary_key Customers_Policies.Customer_ID = Customers.Customer_ID
Policy_ID [ INT ] Customers_Policies.Policy_ID = Available_Policies.Policy_ID
Date_Opened [ TEXT ]
Date_Closed [ TEXT ]

First_Notification_of_Loss :
FNOL_ID [ INT ] primary_key
Customer_ID [ INT ] First_Notification_of_Loss.Customer_ID = Customers_Policies.Customer_ID
Policy_ID [ INT ] First_Notification_of_Loss.Policy_ID = Customers_Policies.Policy_ID
Service_ID [ INT ] First_Notification_of_Loss.Service_ID = Services.Service_ID

Claims :
Claim_ID [ INT ] primary_key
FNOL_ID [ INT ] Claims.FNOL_ID = First_Notification_of_Loss.FNOL_ID
Effective_Date [ TEXT ]

Settlements :
Settlement_ID [ INT ] primary_key
Claim_ID [ INT ] Settlements.Claim_ID = Claims.Claim_ID
Effective_Date [ TEXT ]
Settlement_Amount [ INT ]

Please write me a SQL statement that answers the following question: What are the open and close dates of all the policies used by the customer who have "Diana" in part of their names? [/INST]

Output: SELECT t2.date_opened ,  t2.date_closed FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.customer_name LIKE "%Diana%";


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: How many kinds of enzymes are there? [/INST]

Output: SELECT count(*) FROM enzyme;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What is the total count of enzymes? [/INST]

Output: SELECT count(*) FROM enzyme;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: List the name of enzymes in descending lexicographical order. [/INST]

Output: SELECT name FROM enzyme ORDER BY name DESC;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of enzymes in descending order? [/INST]

Output: SELECT name FROM enzyme ORDER BY name DESC;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: List the names and the locations that the enzymes can make an effect. [/INST]

Output: SELECT name ,  LOCATION FROM enzyme;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names and locations of all enzymes listed? [/INST]

Output: SELECT name ,  LOCATION FROM enzyme;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What is the maximum Online Mendelian Inheritance in Man (OMIM) value of the enzymes? [/INST]

Output: SELECT max(OMIM) FROM enzyme;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What is the maximum OMIM value in the database? [/INST]

Output: SELECT max(OMIM) FROM enzyme;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What is the product, chromosome and porphyria related to the enzymes which take effect at the location 'Cytosol'? [/INST]

Output: SELECT product ,  chromosome ,  porphyria FROM enzyme WHERE LOCATION  =  'Cytosol';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What is the product, chromosome, and porphyria of the enzymes located at 'Cytosol'? [/INST]

Output: SELECT product ,  chromosome ,  porphyria FROM enzyme WHERE LOCATION  =  'Cytosol';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of enzymes who does not produce 'Heme'? [/INST]

Output: SELECT name FROM enzyme WHERE product != 'Heme';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of enzymes whose product is not 'Heme'? [/INST]

Output: SELECT name FROM enzyme WHERE product != 'Heme';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names and trade names of the medicines which has 'Yes' value in the FDA record? [/INST]

Output: SELECT name ,  trade_name FROM medicine WHERE FDA_approved  =  'Yes';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names and trade names of the medcines that are FDA approved? [/INST]

Output: SELECT name ,  trade_name FROM medicine WHERE FDA_approved  =  'Yes';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of enzymes in the medicine named 'Amisulpride' that can serve as an 'inhibitor'? [/INST]

Output: SELECT T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id  =  T2.enzyme_id JOIN medicine AS T3 ON T2.medicine_id  =  T3.id WHERE T3.name  =  'Amisulpride' AND T2.interaction_type  =  'inhibitor';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of the enzymes used in the medicine  Amisulpride that acts as inhibitors? [/INST]

Output: SELECT T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id  =  T2.enzyme_id JOIN medicine AS T3 ON T2.medicine_id  =  T3.id WHERE T3.name  =  'Amisulpride' AND T2.interaction_type  =  'inhibitor';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids and names of the medicine that can interact with two or more enzymes? [/INST]

Output: SELECT T1.id ,  T1.Name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id  =  T1.id GROUP BY T1.id HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: For every medicine id, what are the names of the medicines that can interact with more than one enzyme? [/INST]

Output: SELECT T1.id ,  T1.Name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id  =  T1.id GROUP BY T1.id HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids, names and FDA approval status of medicines in descending order of the number of enzymes that it can interact with. [/INST]

Output: SELECT T1.id ,  T1.Name ,  T1.FDA_approved FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id  =  T1.id GROUP BY T1.id ORDER BY count(*) DESC;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids, names, and FDA approval status for medicines ordered by descending number of possible enzyme interactions? [/INST]

Output: SELECT T1.id ,  T1.Name ,  T1.FDA_approved FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id  =  T1.id GROUP BY T1.id ORDER BY count(*) DESC;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What is the id and name of the enzyme with most number of medicines that can interact as 'activator'? [/INST]

Output: SELECT T1.id ,  T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id  =  T2.enzyme_id WHERE T2.interaction_type  =  'activitor' GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What is the id and name of the enzyme that can interact with the most medicines as an activator? [/INST]

Output: SELECT T1.id ,  T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id  =  T2.enzyme_id WHERE T2.interaction_type  =  'activitor' GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What is the interaction type of the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'? [/INST]

Output: SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id  =  T2.id JOIN enzyme AS T3 ON T1.enzyme_id  =  T3.id WHERE T3.name  =  'ALA synthase' AND T2.name  =  'Aripiprazole';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What is the type of interaction for the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'? [/INST]

Output: SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id  =  T2.id JOIN enzyme AS T3 ON T1.enzyme_id  =  T3.id WHERE T3.name  =  'ALA synthase' AND T2.name  =  'Aripiprazole';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What is the most common interaction type between enzymes and medicine? And how many are there? [/INST]

Output: SELECT interaction_type ,  count(*) FROM medicine_enzyme_interaction GROUP BY interaction_type ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the most common types of interactions between enzymes and medicine, and how many types are there? [/INST]

Output: SELECT interaction_type ,  count(*) FROM medicine_enzyme_interaction GROUP BY interaction_type ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: How many medicines have the FDA approval status 'No' ? [/INST]

Output: SELECT count(*) FROM medicine WHERE FDA_approved  =  'No';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: How many medicines were not approved by the FDA? [/INST]

Output: SELECT count(*) FROM medicine WHERE FDA_approved  =  'No';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

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

Output: SELECT count(*) FROM enzyme WHERE id NOT IN ( SELECT enzyme_id FROM medicine_enzyme_interaction );


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What is the count of enzymes without any interactions? [/INST]

Output: SELECT count(*) FROM enzyme WHERE id NOT IN ( SELECT enzyme_id FROM medicine_enzyme_interaction );


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What is the id and trade name of the medicines can interact with at least 3 enzymes? [/INST]

Output: SELECT T1.id ,  T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id  =  T1.id GROUP BY T1.id HAVING COUNT(*)  >=  3;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids and trade names of the medicine that can interact with at least 3 enzymes? [/INST]

Output: SELECT T1.id ,  T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id  =  T1.id GROUP BY T1.id HAVING COUNT(*)  >=  3;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the distinct name, location and products of the enzymes which has any 'inhibitor' interaction? [/INST]

Output: SELECT DISTINCT T1.name ,  T1.location ,  T1.product FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.enzyme_id  =  T1.id WHERE T2.interaction_type  =  'inhibitor';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the different names, locations, and products of the enzymes that are capable inhibitor interactions? [/INST]

Output: SELECT DISTINCT T1.name ,  T1.location ,  T1.product FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.enzyme_id  =  T1.id WHERE T2.interaction_type  =  'inhibitor';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: List the medicine name and trade name which can both interact as 'inhibitor' and 'activitor' with enzymes. [/INST]

Output: SELECT T1.name ,  T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id  =  T1.id WHERE interaction_type  =  'inhibitor' INTERSECT SELECT T1.name ,  T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id  =  T1.id WHERE interaction_type  =  'activitor';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the medicine and trade names that can interact as an inhibitor and activitor with enzymes? [/INST]

Output: SELECT T1.name ,  T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id  =  T1.id WHERE interaction_type  =  'inhibitor' INTERSECT SELECT T1.name ,  T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id  =  T1.id WHERE interaction_type  =  'activitor';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: Show the medicine names and trade names that cannot interact with the enzyme with product 'Heme'. [/INST]

Output: SELECT name ,  trade_name FROM medicine EXCEPT SELECT T1.name ,  T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id  =  T1.id JOIN enzyme AS T3 ON T3.id  =  T2.enzyme_id WHERE T3.product  =  'Protoporphyrinogen IX';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the medicine and trade names that cannot interact with the enzyme with the product 'Heme'? [/INST]

Output: SELECT name ,  trade_name FROM medicine EXCEPT SELECT T1.name ,  T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id  =  T1.id JOIN enzyme AS T3 ON T3.id  =  T2.enzyme_id WHERE T3.product  =  'Protoporphyrinogen IX';


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: How many distinct FDA approval statuses are there for the medicines? [/INST]

Output: SELECT count(DISTINCT FDA_approved) FROM medicine;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: How many different FDA approval statuses exist for medicines? [/INST]

Output: SELECT count(DISTINCT FDA_approved) FROM medicine;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: Which enzyme names have the substring "ALA"? [/INST]

Output: SELECT name FROM enzyme WHERE name LIKE "%ALA%";


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of enzymes that include the string 'ALA'? [/INST]

Output: SELECT name FROM enzyme WHERE name LIKE "%ALA%";


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: find the number of medicines offered by each trade. [/INST]

Output: SELECT trade_name ,  count(*) FROM medicine GROUP BY trade_name;


Input:
[INST] Here is a database schema:
medicine :
id [ INT ] primary_key
name [ TEXT ]
Trade_Name [ TEXT ]
FDA_approved [ TEXT ]

enzyme :
id [ INT ] primary_key
name [ TEXT ]
Location [ TEXT ]
Product [ TEXT ]
Chromosome [ TEXT ]
OMIM [ INT ]
Porphyria [ TEXT ]

medicine_enzyme_interaction :
enzyme_id [ INT ] primary_key medicine_enzyme_interaction.enzyme_id = enzyme.id
medicine_id [ INT ] medicine_enzyme_interaction.medicine_id = medicine.id
interaction_type [ TEXT ]

Please write me a SQL statement that answers the following question: How many medicines are offered by each trade name? [/INST]

Output: SELECT trade_name ,  count(*) FROM medicine GROUP BY trade_name;


Input:
[INST] Here is a database schema:
basketball_match :
Team_ID [ INT ] primary_key
School_ID [ INT ] basketball_match.School_ID = university.School_ID
Team_Name [ TEXT ]
ACC_Regular_Season [ TEXT ]
ACC_Percent [ TEXT ]
ACC_Home [ TEXT ]
ACC_Road [ TEXT ]
All_Games [ TEXT ]
All_Games_Percent [ INT ]
All_Home [ TEXT ]
All_Road [ TEXT ]
All_Neutral [ TEXT ]

university :
School_ID [ INT ] primary_key
School [ TEXT ]
Location [ TEXT ]
Founded [ INT ]
Affiliation [ TEXT ]
Enrollment [ INT ]
Nickname [ TEXT ]
Primary_conference [ TEXT ]

Please write me a SQL statement that answers the following question: List all schools and their nicknames in the order of founded year. [/INST]

Output: SELECT school ,  nickname FROM university ORDER BY founded;


Input:
[INST] Here is a database schema:
basketball_match :
Team_ID [ INT ] primary_key
School_ID [ INT ] basketball_match.School_ID = university.School_ID
Team_Name [ TEXT ]
ACC_Regular_Season [ TEXT ]
ACC_Percent [ TEXT ]
ACC_Home [ TEXT ]
ACC_Road [ TEXT ]
All_Games [ TEXT ]
All_Games_Percent [ INT ]
All_Home [ TEXT ]
All_Road [ TEXT ]
All_Neutral [ TEXT ]

university :
School_ID [ INT ] primary_key
School [ TEXT ]
Location [ TEXT ]
Founded [ INT ]
Affiliation [ TEXT ]
Enrollment [ INT ]
Nickname [ TEXT ]
Primary_conference [ TEXT ]

Please write me a SQL statement that answers the following question: What are the different schools and their nicknames, ordered by their founding years? [/INST]

Output: SELECT school ,  nickname FROM university ORDER BY founded;