Input:
[INST] Here is a database schema:
people :
People_ID [ INT ] primary_key
District [ TEXT ]
Name [ TEXT ]
Party [ TEXT ]
Age [ INT ]

debate :
Debate_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Num_of_Audience [ INT ]

debate_people :
Debate_ID [ INT ] primary_key debate_people.Debate_ID = debate.Debate_ID
Affirmative [ INT ] debate_people.Affirmative = people.People_ID
Negative [ INT ] debate_people.Negative = people.People_ID
If_Affirmative_Win [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of people that are on affirmative side of debates with number of audience bigger than 200. [/INST]

Output: SELECT T3.Name FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID  =  T2.Debate_ID JOIN people AS T3 ON T1.Affirmative  =  T3.People_ID WHERE T2.Num_of_Audience  >  200;


Input:
[INST] Here is a database schema:
people :
People_ID [ INT ] primary_key
District [ TEXT ]
Name [ TEXT ]
Party [ TEXT ]
Age [ INT ]

debate :
Debate_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Num_of_Audience [ INT ]

debate_people :
Debate_ID [ INT ] primary_key debate_people.Debate_ID = debate.Debate_ID
Affirmative [ INT ] debate_people.Affirmative = people.People_ID
Negative [ INT ] debate_people.Negative = people.People_ID
If_Affirmative_Win [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of people and the number of times they have been on the affirmative side of debates. [/INST]

Output: SELECT T2.Name ,  COUNT(*) FROM debate_people AS T1 JOIN people AS T2 ON T1.Affirmative  =  T2.People_ID GROUP BY T2.Name;


Input:
[INST] Here is a database schema:
people :
People_ID [ INT ] primary_key
District [ TEXT ]
Name [ TEXT ]
Party [ TEXT ]
Age [ INT ]

debate :
Debate_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Num_of_Audience [ INT ]

debate_people :
Debate_ID [ INT ] primary_key debate_people.Debate_ID = debate.Debate_ID
Affirmative [ INT ] debate_people.Affirmative = people.People_ID
Negative [ INT ] debate_people.Negative = people.People_ID
If_Affirmative_Win [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of people who have been on the negative side of debates at least twice. [/INST]

Output: SELECT T2.Name FROM debate_people AS T1 JOIN people AS T2 ON T1.Negative  =  T2.People_ID GROUP BY T2.Name HAVING COUNT(*)  >=  2;


Input:
[INST] Here is a database schema:
people :
People_ID [ INT ] primary_key
District [ TEXT ]
Name [ TEXT ]
Party [ TEXT ]
Age [ INT ]

debate :
Debate_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Num_of_Audience [ INT ]

debate_people :
Debate_ID [ INT ] primary_key debate_people.Debate_ID = debate.Debate_ID
Affirmative [ INT ] debate_people.Affirmative = people.People_ID
Negative [ INT ] debate_people.Negative = people.People_ID
If_Affirmative_Win [ TEXT ]

Please write me a SQL statement that answers the following question: List the names of people that have not been on the affirmative side of debates. [/INST]

Output: SELECT Name FROM people WHERE People_id NOT IN (SELECT Affirmative FROM debate_people);


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

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

Output: SELECT customer_details FROM customers ORDER BY customer_details;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Sort the customer names in alphabetical order. [/INST]

Output: SELECT customer_details FROM customers ORDER BY customer_details;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Find all the policy type codes associated with the customer "Dayana Robel" [/INST]

Output: SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t2.customer_details  =  "Dayana Robel";


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: What are the type codes of the policies used by the customer "Dayana Robel"? [/INST]

Output: SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t2.customer_details  =  "Dayana Robel";


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Which type of policy is most frequently used? Give me the policy type code. [/INST]

Output: SELECT policy_type_code FROM 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_Details [ TEXT ]

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Find the type code of the most frequently used policy. [/INST]

Output: SELECT policy_type_code FROM 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_Details [ TEXT ]

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

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

Output: SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*)  >  2;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Which types of policy are chosen by more than 2 customers? Give me the policy type codes. [/INST]

Output: SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*)  >  2;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Find the total and average amount paid in claim headers. [/INST]

Output: SELECT sum(amount_piad) ,  avg(amount_piad) FROM claim_headers;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: What are the total amount and average amount paid in claim headers? [/INST]

Output: SELECT sum(amount_piad) ,  avg(amount_piad) FROM claim_headers;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Find the total amount claimed in the most recently created document. [/INST]

Output: SELECT sum(t1.amount_claimed) FROM claim_headers AS t1 JOIN claims_documents AS t2 ON t1.claim_header_id  =  t2.claim_id WHERE t2.created_date  =  (SELECT created_date FROM claims_documents ORDER BY created_date LIMIT 1);


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: How much amount in total were claimed in the most recently created document? [/INST]

Output: SELECT sum(t1.amount_claimed) FROM claim_headers AS t1 JOIN claims_documents AS t2 ON t1.claim_header_id  =  t2.claim_id WHERE t2.created_date  =  (SELECT created_date FROM claims_documents ORDER BY created_date LIMIT 1);


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: What is the name of the customer who has made the largest amount of claim in a single claim? [/INST]

Output: SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id  =  t2.policy_id JOIN customers AS t3 ON t2.customer_id  =  t3.customer_id WHERE t1.amount_claimed  =  (SELECT max(amount_claimed) FROM claim_headers);


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Which customer made the largest amount of claim in a single claim? Return the customer details. [/INST]

Output: SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id  =  t2.policy_id JOIN customers AS t3 ON t2.customer_id  =  t3.customer_id WHERE t1.amount_claimed  =  (SELECT max(amount_claimed) FROM claim_headers);


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: What is the name of the customer who has made the minimum amount of payment in one claim? [/INST]

Output: SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id  =  t2.policy_id JOIN customers AS t3 ON t2.customer_id  =  t3.customer_id WHERE t1.amount_piad  =  (SELECT min(amount_piad) FROM claim_headers);


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Which customer made the smallest amount of claim in one claim? Return the customer details. [/INST]

Output: SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id  =  t2.policy_id JOIN customers AS t3 ON t2.customer_id  =  t3.customer_id WHERE t1.amount_piad  =  (SELECT min(amount_piad) FROM claim_headers);


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Find the names of customers who have no policies associated. [/INST]

Output: SELECT customer_details FROM customers EXCEPT SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

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

Output: SELECT customer_details FROM customers EXCEPT SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: How many claim processing stages are there in total? [/INST]

Output: SELECT count(*) FROM claims_processing_stages;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Find the number of distinct stages in claim processing. [/INST]

Output: SELECT count(*) FROM claims_processing_stages;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: What is the name of the claim processing stage that most of the claims are on? [/INST]

Output: SELECT t2.claim_status_name FROM claims_processing AS t1 JOIN claims_processing_stages AS t2 ON t1.claim_stage_id  =  t2.claim_stage_id GROUP BY t1.claim_stage_id ORDER BY count(*) DESC LIMIT 1;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Which claim processing stage has the most claims? Show the claim status name. [/INST]

Output: SELECT t2.claim_status_name FROM claims_processing AS t1 JOIN claims_processing_stages AS t2 ON t1.claim_stage_id  =  t2.claim_stage_id GROUP BY t1.claim_stage_id ORDER BY count(*) DESC LIMIT 1;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

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

Output: SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%";


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Which customers have the substring "Diana" in their names? Return the customer details. [/INST]

Output: SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%";


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Find the names of the customers who have an deputy policy. [/INST]

Output: SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.policy_type_code  =  "Deputy";


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Which customers have an insurance policy with the type code "Deputy"? Give me the customer details. [/INST]

Output: SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.policy_type_code  =  "Deputy";


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Find the names of customers who either have an deputy policy or uniformed policy. [/INST]

Output: SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.policy_type_code  =  "Deputy" OR t1.policy_type_code  =  "Uniform";


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Which customers have an insurance policy with the type code "Deputy" or "Uniform"? Return the customer details. [/INST]

Output: SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.policy_type_code  =  "Deputy" OR t1.policy_type_code  =  "Uniform";


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Find the names of all the customers and staff members. [/INST]

Output: SELECT customer_details FROM customers UNION SELECT staff_details FROM staff;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: What are the names of the customers and staff members? [/INST]

Output: SELECT customer_details FROM customers UNION SELECT staff_details FROM staff;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Find the number of records of each policy type and its type code. [/INST]

Output: SELECT policy_type_code ,  count(*) FROM policies GROUP BY policy_type_code;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: For each policy type, return its type code and its count in the record. [/INST]

Output: SELECT policy_type_code ,  count(*) FROM policies GROUP BY policy_type_code;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Find the name of the customer that has been involved in the most policies. [/INST]

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


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

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

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


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: What is the description of the claim status "Open"? [/INST]

Output: SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name  =  "Open";


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Find the description of the claim status "Open". [/INST]

Output: SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name  =  "Open";


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

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

Output: SELECT count(DISTINCT claim_outcome_code) FROM claims_processing;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Count the number of distinct claim outcome codes. [/INST]

Output: SELECT count(DISTINCT claim_outcome_code) FROM claims_processing;


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Which customer is associated with the latest policy? [/INST]

Output: SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.start_date  =  (SELECT max(start_date) FROM policies);


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

Staff :
Staff_ID [ INT ] primary_key
Staff_Details [ TEXT ]

Policies :
Policy_ID [ INT ] primary_key
Customer_ID [ INT ] Policies.Customer_ID = Customers.Customer_ID
Policy_Type_Code [ TEXT ]
Start_Date [ TEXT ]
End_Date [ TEXT ]

Claim_Headers :
Claim_Header_ID [ INT ] primary_key
Claim_Status_Code [ TEXT ]
Claim_Type_Code [ TEXT ]
Policy_ID [ INT ] Claim_Headers.Policy_ID = Policies.Policy_ID
Date_of_Claim [ TEXT ]
Date_of_Settlement [ TEXT ]
Amount_Claimed [ INT ]
Amount_Piad [ INT ]

Claims_Documents :
Claim_ID [ INT ] primary_key Claims_Documents.Claim_ID = Claim_Headers.Claim_Header_ID
Document_Type_Code [ TEXT ]
Created_by_Staff_ID [ INT ] Claims_Documents.Created_by_Staff_ID = Staff.Staff_ID
Created_Date [ INT ]

Claims_Processing_Stages :
Claim_Stage_ID [ INT ] primary_key
Next_Claim_Stage_ID [ INT ]
Claim_Status_Name [ TEXT ]
Claim_Status_Description [ TEXT ]

Claims_Processing :
Claim_Processing_ID [ INT ] primary_key
Claim_ID [ INT ] Claims_Processing.Claim_ID = Claim_Headers.Claim_Header_ID
Claim_Outcome_Code [ TEXT ]
Claim_Stage_ID [ INT ]
Staff_ID [ INT ] Claims_Processing.Staff_ID = Staff.Staff_ID

Please write me a SQL statement that answers the following question: Find the customer who started a policy most recently. [/INST]

Output: SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.start_date  =  (SELECT max(start_date) FROM policies);


Input:
[INST] Here is a database schema:
Customers :
customer_id [ INT ] primary_key
customer_first_name [ TEXT ]
customer_middle_initial [ TEXT ]
customer_last_name [ TEXT ]
gender [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
login_password [ TEXT ]
phone_number [ TEXT ]
town_city [ TEXT ]
state_county_province [ TEXT ]
country [ TEXT ]

Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Orders.customer_id = Customers.customer_id
date_order_placed [ TEXT ]
order_details [ TEXT ]

Invoices :
invoice_number [ INT ] primary_key
order_id [ INT ] Invoices.order_id = Orders.order_id
invoice_date [ TEXT ]

Accounts :
account_id [ INT ] primary_key
customer_id [ INT ] Accounts.customer_id = Customers.customer_id
date_account_opened [ TEXT ]
account_name [ TEXT ]
other_account_details [ TEXT ]

Product_Categories :
production_type_code [ TEXT ] primary_key
product_type_description [ TEXT ]
vat_rating [ INT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
production_type_code [ TEXT ] Products.production_type_code = Product_Categories.production_type_code
unit_price [ INT ]
product_name [ TEXT ]
product_color [ TEXT ]
product_size [ TEXT ]

Financial_Transactions :
transaction_id [ INT ]
account_id [ INT ] Financial_Transactions.account_id = Accounts.account_id
invoice_number [ INT ] Financial_Transactions.invoice_number = Invoices.invoice_number
transaction_type [ TEXT ]
transaction_date [ TEXT ]
transaction_amount [ INT ]
transaction_comment [ TEXT ]
other_transaction_details [ TEXT ]

Order_Items :
order_item_id [ INT ] primary_key
order_id [ INT ] Order_Items.order_id = Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
product_quantity [ TEXT ]
other_order_item_details [ TEXT ]

Invoice_Line_Items :
order_item_id [ INT ] Invoice_Line_Items.order_item_id = Order_Items.order_item_id
invoice_number [ INT ] Invoice_Line_Items.invoice_number = Invoices.invoice_number
product_id [ INT ] Invoice_Line_Items.product_id = Products.product_id
product_title [ TEXT ]
product_quantity [ TEXT ]
product_price [ INT ]
derived_product_cost [ INT ]
derived_vat_payable [ INT ]
derived_total_cost [ INT ]

Please write me a SQL statement that answers the following question: Show the number of accounts. [/INST]

Output: SELECT count(*) FROM Accounts;


Input:
[INST] Here is a database schema:
Customers :
customer_id [ INT ] primary_key
customer_first_name [ TEXT ]
customer_middle_initial [ TEXT ]
customer_last_name [ TEXT ]
gender [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
login_password [ TEXT ]
phone_number [ TEXT ]
town_city [ TEXT ]
state_county_province [ TEXT ]
country [ TEXT ]

Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Orders.customer_id = Customers.customer_id
date_order_placed [ TEXT ]
order_details [ TEXT ]

Invoices :
invoice_number [ INT ] primary_key
order_id [ INT ] Invoices.order_id = Orders.order_id
invoice_date [ TEXT ]

Accounts :
account_id [ INT ] primary_key
customer_id [ INT ] Accounts.customer_id = Customers.customer_id
date_account_opened [ TEXT ]
account_name [ TEXT ]
other_account_details [ TEXT ]

Product_Categories :
production_type_code [ TEXT ] primary_key
product_type_description [ TEXT ]
vat_rating [ INT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
production_type_code [ TEXT ] Products.production_type_code = Product_Categories.production_type_code
unit_price [ INT ]
product_name [ TEXT ]
product_color [ TEXT ]
product_size [ TEXT ]

Financial_Transactions :
transaction_id [ INT ]
account_id [ INT ] Financial_Transactions.account_id = Accounts.account_id
invoice_number [ INT ] Financial_Transactions.invoice_number = Invoices.invoice_number
transaction_type [ TEXT ]
transaction_date [ TEXT ]
transaction_amount [ INT ]
transaction_comment [ TEXT ]
other_transaction_details [ TEXT ]

Order_Items :
order_item_id [ INT ] primary_key
order_id [ INT ] Order_Items.order_id = Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
product_quantity [ TEXT ]
other_order_item_details [ TEXT ]

Invoice_Line_Items :
order_item_id [ INT ] Invoice_Line_Items.order_item_id = Order_Items.order_item_id
invoice_number [ INT ] Invoice_Line_Items.invoice_number = Invoices.invoice_number
product_id [ INT ] Invoice_Line_Items.product_id = Products.product_id
product_title [ TEXT ]
product_quantity [ TEXT ]
product_price [ INT ]
derived_product_cost [ INT ]
derived_vat_payable [ INT ]
derived_total_cost [ INT ]

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

Output: SELECT count(*) FROM Accounts;


Input:
[INST] Here is a database schema:
Customers :
customer_id [ INT ] primary_key
customer_first_name [ TEXT ]
customer_middle_initial [ TEXT ]
customer_last_name [ TEXT ]
gender [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
login_password [ TEXT ]
phone_number [ TEXT ]
town_city [ TEXT ]
state_county_province [ TEXT ]
country [ TEXT ]

Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Orders.customer_id = Customers.customer_id
date_order_placed [ TEXT ]
order_details [ TEXT ]

Invoices :
invoice_number [ INT ] primary_key
order_id [ INT ] Invoices.order_id = Orders.order_id
invoice_date [ TEXT ]

Accounts :
account_id [ INT ] primary_key
customer_id [ INT ] Accounts.customer_id = Customers.customer_id
date_account_opened [ TEXT ]
account_name [ TEXT ]
other_account_details [ TEXT ]

Product_Categories :
production_type_code [ TEXT ] primary_key
product_type_description [ TEXT ]
vat_rating [ INT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
production_type_code [ TEXT ] Products.production_type_code = Product_Categories.production_type_code
unit_price [ INT ]
product_name [ TEXT ]
product_color [ TEXT ]
product_size [ TEXT ]

Financial_Transactions :
transaction_id [ INT ]
account_id [ INT ] Financial_Transactions.account_id = Accounts.account_id
invoice_number [ INT ] Financial_Transactions.invoice_number = Invoices.invoice_number
transaction_type [ TEXT ]
transaction_date [ TEXT ]
transaction_amount [ INT ]
transaction_comment [ TEXT ]
other_transaction_details [ TEXT ]

Order_Items :
order_item_id [ INT ] primary_key
order_id [ INT ] Order_Items.order_id = Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
product_quantity [ TEXT ]
other_order_item_details [ TEXT ]

Invoice_Line_Items :
order_item_id [ INT ] Invoice_Line_Items.order_item_id = Order_Items.order_item_id
invoice_number [ INT ] Invoice_Line_Items.invoice_number = Invoices.invoice_number
product_id [ INT ] Invoice_Line_Items.product_id = Products.product_id
product_title [ TEXT ]
product_quantity [ TEXT ]
product_price [ INT ]
derived_product_cost [ INT ]
derived_vat_payable [ INT ]
derived_total_cost [ INT ]

Please write me a SQL statement that answers the following question: How many customers have opened an account? [/INST]

Output: SELECT count(DISTINCT customer_id) FROM Accounts;


Input:
[INST] Here is a database schema:
Customers :
customer_id [ INT ] primary_key
customer_first_name [ TEXT ]
customer_middle_initial [ TEXT ]
customer_last_name [ TEXT ]
gender [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
login_password [ TEXT ]
phone_number [ TEXT ]
town_city [ TEXT ]
state_county_province [ TEXT ]
country [ TEXT ]

Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Orders.customer_id = Customers.customer_id
date_order_placed [ TEXT ]
order_details [ TEXT ]

Invoices :
invoice_number [ INT ] primary_key
order_id [ INT ] Invoices.order_id = Orders.order_id
invoice_date [ TEXT ]

Accounts :
account_id [ INT ] primary_key
customer_id [ INT ] Accounts.customer_id = Customers.customer_id
date_account_opened [ TEXT ]
account_name [ TEXT ]
other_account_details [ TEXT ]

Product_Categories :
production_type_code [ TEXT ] primary_key
product_type_description [ TEXT ]
vat_rating [ INT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
production_type_code [ TEXT ] Products.production_type_code = Product_Categories.production_type_code
unit_price [ INT ]
product_name [ TEXT ]
product_color [ TEXT ]
product_size [ TEXT ]

Financial_Transactions :
transaction_id [ INT ]
account_id [ INT ] Financial_Transactions.account_id = Accounts.account_id
invoice_number [ INT ] Financial_Transactions.invoice_number = Invoices.invoice_number
transaction_type [ TEXT ]
transaction_date [ TEXT ]
transaction_amount [ INT ]
transaction_comment [ TEXT ]
other_transaction_details [ TEXT ]

Order_Items :
order_item_id [ INT ] primary_key
order_id [ INT ] Order_Items.order_id = Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
product_quantity [ TEXT ]
other_order_item_details [ TEXT ]

Invoice_Line_Items :
order_item_id [ INT ] Invoice_Line_Items.order_item_id = Order_Items.order_item_id
invoice_number [ INT ] Invoice_Line_Items.invoice_number = Invoices.invoice_number
product_id [ INT ] Invoice_Line_Items.product_id = Products.product_id
product_title [ TEXT ]
product_quantity [ TEXT ]
product_price [ INT ]
derived_product_cost [ INT ]
derived_vat_payable [ INT ]
derived_total_cost [ INT ]

Please write me a SQL statement that answers the following question: Count the number of customers who have an account. [/INST]

Output: SELECT count(DISTINCT customer_id) FROM Accounts;


Input:
[INST] Here is a database schema:
Customers :
customer_id [ INT ] primary_key
customer_first_name [ TEXT ]
customer_middle_initial [ TEXT ]
customer_last_name [ TEXT ]
gender [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
login_password [ TEXT ]
phone_number [ TEXT ]
town_city [ TEXT ]
state_county_province [ TEXT ]
country [ TEXT ]

Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Orders.customer_id = Customers.customer_id
date_order_placed [ TEXT ]
order_details [ TEXT ]

Invoices :
invoice_number [ INT ] primary_key
order_id [ INT ] Invoices.order_id = Orders.order_id
invoice_date [ TEXT ]

Accounts :
account_id [ INT ] primary_key
customer_id [ INT ] Accounts.customer_id = Customers.customer_id
date_account_opened [ TEXT ]
account_name [ TEXT ]
other_account_details [ TEXT ]

Product_Categories :
production_type_code [ TEXT ] primary_key
product_type_description [ TEXT ]
vat_rating [ INT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
production_type_code [ TEXT ] Products.production_type_code = Product_Categories.production_type_code
unit_price [ INT ]
product_name [ TEXT ]
product_color [ TEXT ]
product_size [ TEXT ]

Financial_Transactions :
transaction_id [ INT ]
account_id [ INT ] Financial_Transactions.account_id = Accounts.account_id
invoice_number [ INT ] Financial_Transactions.invoice_number = Invoices.invoice_number
transaction_type [ TEXT ]
transaction_date [ TEXT ]
transaction_amount [ INT ]
transaction_comment [ TEXT ]
other_transaction_details [ TEXT ]

Order_Items :
order_item_id [ INT ] primary_key
order_id [ INT ] Order_Items.order_id = Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
product_quantity [ TEXT ]
other_order_item_details [ TEXT ]

Invoice_Line_Items :
order_item_id [ INT ] Invoice_Line_Items.order_item_id = Order_Items.order_item_id
invoice_number [ INT ] Invoice_Line_Items.invoice_number = Invoices.invoice_number
product_id [ INT ] Invoice_Line_Items.product_id = Products.product_id
product_title [ TEXT ]
product_quantity [ TEXT ]
product_price [ INT ]
derived_product_cost [ INT ]
derived_vat_payable [ INT ]
derived_total_cost [ INT ]

Please write me a SQL statement that answers the following question: Show the id, the date of account opened, the account name, and other account detail for all accounts. [/INST]

Output: SELECT account_id ,  date_account_opened ,  account_name ,  other_account_details FROM Accounts;


Input:
[INST] Here is a database schema:
Customers :
customer_id [ INT ] primary_key
customer_first_name [ TEXT ]
customer_middle_initial [ TEXT ]
customer_last_name [ TEXT ]
gender [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
login_password [ TEXT ]
phone_number [ TEXT ]
town_city [ TEXT ]
state_county_province [ TEXT ]
country [ TEXT ]

Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Orders.customer_id = Customers.customer_id
date_order_placed [ TEXT ]
order_details [ TEXT ]

Invoices :
invoice_number [ INT ] primary_key
order_id [ INT ] Invoices.order_id = Orders.order_id
invoice_date [ TEXT ]

Accounts :
account_id [ INT ] primary_key
customer_id [ INT ] Accounts.customer_id = Customers.customer_id
date_account_opened [ TEXT ]
account_name [ TEXT ]
other_account_details [ TEXT ]

Product_Categories :
production_type_code [ TEXT ] primary_key
product_type_description [ TEXT ]
vat_rating [ INT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
production_type_code [ TEXT ] Products.production_type_code = Product_Categories.production_type_code
unit_price [ INT ]
product_name [ TEXT ]
product_color [ TEXT ]
product_size [ TEXT ]

Financial_Transactions :
transaction_id [ INT ]
account_id [ INT ] Financial_Transactions.account_id = Accounts.account_id
invoice_number [ INT ] Financial_Transactions.invoice_number = Invoices.invoice_number
transaction_type [ TEXT ]
transaction_date [ TEXT ]
transaction_amount [ INT ]
transaction_comment [ TEXT ]
other_transaction_details [ TEXT ]

Order_Items :
order_item_id [ INT ] primary_key
order_id [ INT ] Order_Items.order_id = Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
product_quantity [ TEXT ]
other_order_item_details [ TEXT ]

Invoice_Line_Items :
order_item_id [ INT ] Invoice_Line_Items.order_item_id = Order_Items.order_item_id
invoice_number [ INT ] Invoice_Line_Items.invoice_number = Invoices.invoice_number
product_id [ INT ] Invoice_Line_Items.product_id = Products.product_id
product_title [ TEXT ]
product_quantity [ TEXT ]
product_price [ INT ]
derived_product_cost [ INT ]
derived_vat_payable [ INT ]
derived_total_cost [ INT ]

Please write me a SQL statement that answers the following question: What are the ids, date opened, name, and other details for all accounts? [/INST]

Output: SELECT account_id ,  date_account_opened ,  account_name ,  other_account_details FROM Accounts;


Input:
[INST] Here is a database schema:
Customers :
customer_id [ INT ] primary_key
customer_first_name [ TEXT ]
customer_middle_initial [ TEXT ]
customer_last_name [ TEXT ]
gender [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
login_password [ TEXT ]
phone_number [ TEXT ]
town_city [ TEXT ]
state_county_province [ TEXT ]
country [ TEXT ]

Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Orders.customer_id = Customers.customer_id
date_order_placed [ TEXT ]
order_details [ TEXT ]

Invoices :
invoice_number [ INT ] primary_key
order_id [ INT ] Invoices.order_id = Orders.order_id
invoice_date [ TEXT ]

Accounts :
account_id [ INT ] primary_key
customer_id [ INT ] Accounts.customer_id = Customers.customer_id
date_account_opened [ TEXT ]
account_name [ TEXT ]
other_account_details [ TEXT ]

Product_Categories :
production_type_code [ TEXT ] primary_key
product_type_description [ TEXT ]
vat_rating [ INT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
production_type_code [ TEXT ] Products.production_type_code = Product_Categories.production_type_code
unit_price [ INT ]
product_name [ TEXT ]
product_color [ TEXT ]
product_size [ TEXT ]

Financial_Transactions :
transaction_id [ INT ]
account_id [ INT ] Financial_Transactions.account_id = Accounts.account_id
invoice_number [ INT ] Financial_Transactions.invoice_number = Invoices.invoice_number
transaction_type [ TEXT ]
transaction_date [ TEXT ]
transaction_amount [ INT ]
transaction_comment [ TEXT ]
other_transaction_details [ TEXT ]

Order_Items :
order_item_id [ INT ] primary_key
order_id [ INT ] Order_Items.order_id = Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
product_quantity [ TEXT ]
other_order_item_details [ TEXT ]

Invoice_Line_Items :
order_item_id [ INT ] Invoice_Line_Items.order_item_id = Order_Items.order_item_id
invoice_number [ INT ] Invoice_Line_Items.invoice_number = Invoices.invoice_number
product_id [ INT ] Invoice_Line_Items.product_id = Products.product_id
product_title [ TEXT ]
product_quantity [ TEXT ]
product_price [ INT ]
derived_product_cost [ INT ]
derived_vat_payable [ INT ]
derived_total_cost [ INT ]

Please write me a SQL statement that answers the following question: Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'. [/INST]

Output: SELECT T1.account_id ,  T1.date_account_opened ,  T1.account_name ,  T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.customer_first_name  =  'Meaghan';


Input:
[INST] Here is a database schema:
Customers :
customer_id [ INT ] primary_key
customer_first_name [ TEXT ]
customer_middle_initial [ TEXT ]
customer_last_name [ TEXT ]
gender [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
login_password [ TEXT ]
phone_number [ TEXT ]
town_city [ TEXT ]
state_county_province [ TEXT ]
country [ TEXT ]

Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Orders.customer_id = Customers.customer_id
date_order_placed [ TEXT ]
order_details [ TEXT ]

Invoices :
invoice_number [ INT ] primary_key
order_id [ INT ] Invoices.order_id = Orders.order_id
invoice_date [ TEXT ]

Accounts :
account_id [ INT ] primary_key
customer_id [ INT ] Accounts.customer_id = Customers.customer_id
date_account_opened [ TEXT ]
account_name [ TEXT ]
other_account_details [ TEXT ]

Product_Categories :
production_type_code [ TEXT ] primary_key
product_type_description [ TEXT ]
vat_rating [ INT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
production_type_code [ TEXT ] Products.production_type_code = Product_Categories.production_type_code
unit_price [ INT ]
product_name [ TEXT ]
product_color [ TEXT ]
product_size [ TEXT ]

Financial_Transactions :
transaction_id [ INT ]
account_id [ INT ] Financial_Transactions.account_id = Accounts.account_id
invoice_number [ INT ] Financial_Transactions.invoice_number = Invoices.invoice_number
transaction_type [ TEXT ]
transaction_date [ TEXT ]
transaction_amount [ INT ]
transaction_comment [ TEXT ]
other_transaction_details [ TEXT ]

Order_Items :
order_item_id [ INT ] primary_key
order_id [ INT ] Order_Items.order_id = Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
product_quantity [ TEXT ]
other_order_item_details [ TEXT ]

Invoice_Line_Items :
order_item_id [ INT ] Invoice_Line_Items.order_item_id = Order_Items.order_item_id
invoice_number [ INT ] Invoice_Line_Items.invoice_number = Invoices.invoice_number
product_id [ INT ] Invoice_Line_Items.product_id = Products.product_id
product_title [ TEXT ]
product_quantity [ TEXT ]
product_price [ INT ]
derived_product_cost [ INT ]
derived_vat_payable [ INT ]
derived_total_cost [ INT ]

Please write me a SQL statement that answers the following question: What are the ids, names, dates of opening, and other details for accounts corresponding to the customer with the first name "Meaghan"? [/INST]

Output: SELECT T1.account_id ,  T1.date_account_opened ,  T1.account_name ,  T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.customer_first_name  =  'Meaghan';


Input:
[INST] Here is a database schema:
Customers :
customer_id [ INT ] primary_key
customer_first_name [ TEXT ]
customer_middle_initial [ TEXT ]
customer_last_name [ TEXT ]
gender [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
login_password [ TEXT ]
phone_number [ TEXT ]
town_city [ TEXT ]
state_county_province [ TEXT ]
country [ TEXT ]

Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Orders.customer_id = Customers.customer_id
date_order_placed [ TEXT ]
order_details [ TEXT ]

Invoices :
invoice_number [ INT ] primary_key
order_id [ INT ] Invoices.order_id = Orders.order_id
invoice_date [ TEXT ]

Accounts :
account_id [ INT ] primary_key
customer_id [ INT ] Accounts.customer_id = Customers.customer_id
date_account_opened [ TEXT ]
account_name [ TEXT ]
other_account_details [ TEXT ]

Product_Categories :
production_type_code [ TEXT ] primary_key
product_type_description [ TEXT ]
vat_rating [ INT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
production_type_code [ TEXT ] Products.production_type_code = Product_Categories.production_type_code
unit_price [ INT ]
product_name [ TEXT ]
product_color [ TEXT ]
product_size [ TEXT ]

Financial_Transactions :
transaction_id [ INT ]
account_id [ INT ] Financial_Transactions.account_id = Accounts.account_id
invoice_number [ INT ] Financial_Transactions.invoice_number = Invoices.invoice_number
transaction_type [ TEXT ]
transaction_date [ TEXT ]
transaction_amount [ INT ]
transaction_comment [ TEXT ]
other_transaction_details [ TEXT ]

Order_Items :
order_item_id [ INT ] primary_key
order_id [ INT ] Order_Items.order_id = Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
product_quantity [ TEXT ]
other_order_item_details [ TEXT ]

Invoice_Line_Items :
order_item_id [ INT ] Invoice_Line_Items.order_item_id = Order_Items.order_item_id
invoice_number [ INT ] Invoice_Line_Items.invoice_number = Invoices.invoice_number
product_id [ INT ] Invoice_Line_Items.product_id = Products.product_id
product_title [ TEXT ]
product_quantity [ TEXT ]
product_price [ INT ]
derived_product_cost [ INT ]
derived_vat_payable [ INT ]
derived_total_cost [ INT ]

Please write me a SQL statement that answers the following question: Show the account name and other account detail for all accounts by the customer with first name Meaghan and last name Keeling. [/INST]

Output: SELECT T1.account_name ,  T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.customer_first_name  =  "Meaghan" AND T2.customer_last_name  =  "Keeling";


Input:
[INST] Here is a database schema:
Customers :
customer_id [ INT ] primary_key
customer_first_name [ TEXT ]
customer_middle_initial [ TEXT ]
customer_last_name [ TEXT ]
gender [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
login_password [ TEXT ]
phone_number [ TEXT ]
town_city [ TEXT ]
state_county_province [ TEXT ]
country [ TEXT ]

Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Orders.customer_id = Customers.customer_id
date_order_placed [ TEXT ]
order_details [ TEXT ]

Invoices :
invoice_number [ INT ] primary_key
order_id [ INT ] Invoices.order_id = Orders.order_id
invoice_date [ TEXT ]

Accounts :
account_id [ INT ] primary_key
customer_id [ INT ] Accounts.customer_id = Customers.customer_id
date_account_opened [ TEXT ]
account_name [ TEXT ]
other_account_details [ TEXT ]

Product_Categories :
production_type_code [ TEXT ] primary_key
product_type_description [ TEXT ]
vat_rating [ INT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
production_type_code [ TEXT ] Products.production_type_code = Product_Categories.production_type_code
unit_price [ INT ]
product_name [ TEXT ]
product_color [ TEXT ]
product_size [ TEXT ]

Financial_Transactions :
transaction_id [ INT ]
account_id [ INT ] Financial_Transactions.account_id = Accounts.account_id
invoice_number [ INT ] Financial_Transactions.invoice_number = Invoices.invoice_number
transaction_type [ TEXT ]
transaction_date [ TEXT ]
transaction_amount [ INT ]
transaction_comment [ TEXT ]
other_transaction_details [ TEXT ]

Order_Items :
order_item_id [ INT ] primary_key
order_id [ INT ] Order_Items.order_id = Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
product_quantity [ TEXT ]
other_order_item_details [ TEXT ]

Invoice_Line_Items :
order_item_id [ INT ] Invoice_Line_Items.order_item_id = Order_Items.order_item_id
invoice_number [ INT ] Invoice_Line_Items.invoice_number = Invoices.invoice_number
product_id [ INT ] Invoice_Line_Items.product_id = Products.product_id
product_title [ TEXT ]
product_quantity [ TEXT ]
product_price [ INT ]
derived_product_cost [ INT ]
derived_vat_payable [ INT ]
derived_total_cost [ INT ]

Please write me a SQL statement that answers the following question: What are the names and other details for accounts corresponding to the customer named Meaghan Keeling? [/INST]

Output: SELECT T1.account_name ,  T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.customer_first_name  =  "Meaghan" AND T2.customer_last_name  =  "Keeling";


Input:
[INST] Here is a database schema:
Customers :
customer_id [ INT ] primary_key
customer_first_name [ TEXT ]
customer_middle_initial [ TEXT ]
customer_last_name [ TEXT ]
gender [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
login_password [ TEXT ]
phone_number [ TEXT ]
town_city [ TEXT ]
state_county_province [ TEXT ]
country [ TEXT ]

Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Orders.customer_id = Customers.customer_id
date_order_placed [ TEXT ]
order_details [ TEXT ]

Invoices :
invoice_number [ INT ] primary_key
order_id [ INT ] Invoices.order_id = Orders.order_id
invoice_date [ TEXT ]

Accounts :
account_id [ INT ] primary_key
customer_id [ INT ] Accounts.customer_id = Customers.customer_id
date_account_opened [ TEXT ]
account_name [ TEXT ]
other_account_details [ TEXT ]

Product_Categories :
production_type_code [ TEXT ] primary_key
product_type_description [ TEXT ]
vat_rating [ INT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
production_type_code [ TEXT ] Products.production_type_code = Product_Categories.production_type_code
unit_price [ INT ]
product_name [ TEXT ]
product_color [ TEXT ]
product_size [ TEXT ]

Financial_Transactions :
transaction_id [ INT ]
account_id [ INT ] Financial_Transactions.account_id = Accounts.account_id
invoice_number [ INT ] Financial_Transactions.invoice_number = Invoices.invoice_number
transaction_type [ TEXT ]
transaction_date [ TEXT ]
transaction_amount [ INT ]
transaction_comment [ TEXT ]
other_transaction_details [ TEXT ]

Order_Items :
order_item_id [ INT ] primary_key
order_id [ INT ] Order_Items.order_id = Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
product_quantity [ TEXT ]
other_order_item_details [ TEXT ]

Invoice_Line_Items :
order_item_id [ INT ] Invoice_Line_Items.order_item_id = Order_Items.order_item_id
invoice_number [ INT ] Invoice_Line_Items.invoice_number = Invoices.invoice_number
product_id [ INT ] Invoice_Line_Items.product_id = Products.product_id
product_title [ TEXT ]
product_quantity [ TEXT ]
product_price [ INT ]
derived_product_cost [ INT ]
derived_vat_payable [ INT ]
derived_total_cost [ INT ]

Please write me a SQL statement that answers the following question: Show the first name and last name for the customer with account name 900. [/INST]

Output: SELECT T2.customer_first_name ,  T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T1.account_name  =  "900";


Input:
[INST] Here is a database schema:
Customers :
customer_id [ INT ] primary_key
customer_first_name [ TEXT ]
customer_middle_initial [ TEXT ]
customer_last_name [ TEXT ]
gender [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
login_password [ TEXT ]
phone_number [ TEXT ]
town_city [ TEXT ]
state_county_province [ TEXT ]
country [ TEXT ]

Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Orders.customer_id = Customers.customer_id
date_order_placed [ TEXT ]
order_details [ TEXT ]

Invoices :
invoice_number [ INT ] primary_key
order_id [ INT ] Invoices.order_id = Orders.order_id
invoice_date [ TEXT ]

Accounts :
account_id [ INT ] primary_key
customer_id [ INT ] Accounts.customer_id = Customers.customer_id
date_account_opened [ TEXT ]
account_name [ TEXT ]
other_account_details [ TEXT ]

Product_Categories :
production_type_code [ TEXT ] primary_key
product_type_description [ TEXT ]
vat_rating [ INT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
production_type_code [ TEXT ] Products.production_type_code = Product_Categories.production_type_code
unit_price [ INT ]
product_name [ TEXT ]
product_color [ TEXT ]
product_size [ TEXT ]

Financial_Transactions :
transaction_id [ INT ]
account_id [ INT ] Financial_Transactions.account_id = Accounts.account_id
invoice_number [ INT ] Financial_Transactions.invoice_number = Invoices.invoice_number
transaction_type [ TEXT ]
transaction_date [ TEXT ]
transaction_amount [ INT ]
transaction_comment [ TEXT ]
other_transaction_details [ TEXT ]

Order_Items :
order_item_id [ INT ] primary_key
order_id [ INT ] Order_Items.order_id = Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
product_quantity [ TEXT ]
other_order_item_details [ TEXT ]

Invoice_Line_Items :
order_item_id [ INT ] Invoice_Line_Items.order_item_id = Order_Items.order_item_id
invoice_number [ INT ] Invoice_Line_Items.invoice_number = Invoices.invoice_number
product_id [ INT ] Invoice_Line_Items.product_id = Products.product_id
product_title [ TEXT ]
product_quantity [ TEXT ]
product_price [ INT ]
derived_product_cost [ INT ]
derived_vat_payable [ INT ]
derived_total_cost [ INT ]

Please write me a SQL statement that answers the following question: What are the full names of customers with the account name 900? [/INST]

Output: SELECT T2.customer_first_name ,  T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T1.account_name  =  "900";


Input:
[INST] Here is a database schema:
Customers :
customer_id [ INT ] primary_key
customer_first_name [ TEXT ]
customer_middle_initial [ TEXT ]
customer_last_name [ TEXT ]
gender [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
login_password [ TEXT ]
phone_number [ TEXT ]
town_city [ TEXT ]
state_county_province [ TEXT ]
country [ TEXT ]

Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Orders.customer_id = Customers.customer_id
date_order_placed [ TEXT ]
order_details [ TEXT ]

Invoices :
invoice_number [ INT ] primary_key
order_id [ INT ] Invoices.order_id = Orders.order_id
invoice_date [ TEXT ]

Accounts :
account_id [ INT ] primary_key
customer_id [ INT ] Accounts.customer_id = Customers.customer_id
date_account_opened [ TEXT ]
account_name [ TEXT ]
other_account_details [ TEXT ]

Product_Categories :
production_type_code [ TEXT ] primary_key
product_type_description [ TEXT ]
vat_rating [ INT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
production_type_code [ TEXT ] Products.production_type_code = Product_Categories.production_type_code
unit_price [ INT ]
product_name [ TEXT ]
product_color [ TEXT ]
product_size [ TEXT ]

Financial_Transactions :
transaction_id [ INT ]
account_id [ INT ] Financial_Transactions.account_id = Accounts.account_id
invoice_number [ INT ] Financial_Transactions.invoice_number = Invoices.invoice_number
transaction_type [ TEXT ]
transaction_date [ TEXT ]
transaction_amount [ INT ]
transaction_comment [ TEXT ]
other_transaction_details [ TEXT ]

Order_Items :
order_item_id [ INT ] primary_key
order_id [ INT ] Order_Items.order_id = Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
product_quantity [ TEXT ]
other_order_item_details [ TEXT ]

Invoice_Line_Items :
order_item_id [ INT ] Invoice_Line_Items.order_item_id = Order_Items.order_item_id
invoice_number [ INT ] Invoice_Line_Items.invoice_number = Invoices.invoice_number
product_id [ INT ] Invoice_Line_Items.product_id = Products.product_id
product_title [ TEXT ]
product_quantity [ TEXT ]
product_price [ INT ]
derived_product_cost [ INT ]
derived_vat_payable [ INT ]
derived_total_cost [ INT ]

Please write me a SQL statement that answers the following question: How many customers don't have an account? [/INST]

Output: SELECT count(*) FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts);


Input:
[INST] Here is a database schema:
Customers :
customer_id [ INT ] primary_key
customer_first_name [ TEXT ]
customer_middle_initial [ TEXT ]
customer_last_name [ TEXT ]
gender [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
login_password [ TEXT ]
phone_number [ TEXT ]
town_city [ TEXT ]
state_county_province [ TEXT ]
country [ TEXT ]

Orders :
order_id [ INT ] primary_key
customer_id [ INT ] Orders.customer_id = Customers.customer_id
date_order_placed [ TEXT ]
order_details [ TEXT ]

Invoices :
invoice_number [ INT ] primary_key
order_id [ INT ] Invoices.order_id = Orders.order_id
invoice_date [ TEXT ]

Accounts :
account_id [ INT ] primary_key
customer_id [ INT ] Accounts.customer_id = Customers.customer_id
date_account_opened [ TEXT ]
account_name [ TEXT ]
other_account_details [ TEXT ]

Product_Categories :
production_type_code [ TEXT ] primary_key
product_type_description [ TEXT ]
vat_rating [ INT ]

Products :
product_id [ INT ] primary_key
parent_product_id [ INT ]
production_type_code [ TEXT ] Products.production_type_code = Product_Categories.production_type_code
unit_price [ INT ]
product_name [ TEXT ]
product_color [ TEXT ]
product_size [ TEXT ]

Financial_Transactions :
transaction_id [ INT ]
account_id [ INT ] Financial_Transactions.account_id = Accounts.account_id
invoice_number [ INT ] Financial_Transactions.invoice_number = Invoices.invoice_number
transaction_type [ TEXT ]
transaction_date [ TEXT ]
transaction_amount [ INT ]
transaction_comment [ TEXT ]
other_transaction_details [ TEXT ]

Order_Items :
order_item_id [ INT ] primary_key
order_id [ INT ] Order_Items.order_id = Orders.order_id
product_id [ INT ] Order_Items.product_id = Products.product_id
product_quantity [ TEXT ]
other_order_item_details [ TEXT ]

Invoice_Line_Items :
order_item_id [ INT ] Invoice_Line_Items.order_item_id = Order_Items.order_item_id
invoice_number [ INT ] Invoice_Line_Items.invoice_number = Invoices.invoice_number
product_id [ INT ] Invoice_Line_Items.product_id = Products.product_id
product_title [ TEXT ]
product_quantity [ TEXT ]
product_price [ INT ]
derived_product_cost [ INT ]
derived_vat_payable [ INT ]
derived_total_cost [ INT ]

Please write me a SQL statement that answers the following question: Count the number of customers who do not have an account. [/INST]

Output: SELECT count(*) FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts);