output
stringlengths
18
577
instruction
stringlengths
16
224
input
stringclasses
160 values
SELECT DISTINCT Venue FROM debate
Show the distinct venues of debates
"Schema (values (type))": people : People_ID (number) , District (text) , Name (text) , Party (text) , Age (number) | debate : Debate_ID (number) , Date (text) , Venue (text) , Num_of_Audience (number) | debate_people : Debate_ID (number) , Affirmative (number) , Negative (number) , If_Affirmative_Win (others) "Primary Keys": people : People_ID | debate : Debate_ID | debate_people : Debate_ID "Foreign Keys": debate_people : Negative equals people : People_ID | debate_people : Affirmative equals people : People_ID | debate_people : Debate_ID equals debate : Debate_ID
SELECT T3.Name , T2.Date , T2.Venue 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
Show the names of people, and dates and venues of debates they are on the affirmative side.
"Schema (values (type))": people : People_ID (number) , District (text) , Name (text) , Party (text) , Age (number) | debate : Debate_ID (number) , Date (text) , Venue (text) , Num_of_Audience (number) | debate_people : Debate_ID (number) , Affirmative (number) , Negative (number) , If_Affirmative_Win (others) "Primary Keys": people : People_ID | debate : Debate_ID | debate_people : Debate_ID "Foreign Keys": debate_people : Negative equals people : People_ID | debate_people : Affirmative equals people : People_ID | debate_people : Debate_ID equals debate : Debate_ID
SELECT T3.Name , T2.Date , T2.Venue FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Negative = T3.People_ID ORDER BY T3.Name ASC
Show the names of people, and dates and venues of debates they are on the negative side, ordered in ascending alphabetical order of name.
"Schema (values (type))": people : People_ID (number) , District (text) , Name (text) , Party (text) , Age (number) | debate : Debate_ID (number) , Date (text) , Venue (text) , Num_of_Audience (number) | debate_people : Debate_ID (number) , Affirmative (number) , Negative (number) , If_Affirmative_Win (others) "Primary Keys": people : People_ID | debate : Debate_ID | debate_people : Debate_ID "Foreign Keys": debate_people : Negative equals people : People_ID | debate_people : Affirmative equals people : People_ID | debate_people : Debate_ID equals debate : Debate_ID
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
Show the names of people that are on affirmative side of debates with number of audience bigger than 200.
"Schema (values (type))": people : People_ID (number) , District (text) , Name (text) , Party (text) , Age (number) | debate : Debate_ID (number) , Date (text) , Venue (text) , Num_of_Audience (number) | debate_people : Debate_ID (number) , Affirmative (number) , Negative (number) , If_Affirmative_Win (others) "Primary Keys": people : People_ID | debate : Debate_ID | debate_people : Debate_ID "Foreign Keys": debate_people : Negative equals people : People_ID | debate_people : Affirmative equals people : People_ID | debate_people : Debate_ID equals debate : Debate_ID
SELECT T2.Name , COUNT(*) FROM debate_people AS T1 JOIN people AS T2 ON T1.Affirmative = T2.People_ID GROUP BY T2.Name
Show the names of people and the number of times they have been on the affirmative side of debates.
"Schema (values (type))": people : People_ID (number) , District (text) , Name (text) , Party (text) , Age (number) | debate : Debate_ID (number) , Date (text) , Venue (text) , Num_of_Audience (number) | debate_people : Debate_ID (number) , Affirmative (number) , Negative (number) , If_Affirmative_Win (others) "Primary Keys": people : People_ID | debate : Debate_ID | debate_people : Debate_ID "Foreign Keys": debate_people : Negative equals people : People_ID | debate_people : Affirmative equals people : People_ID | debate_people : Debate_ID equals debate : Debate_ID
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
Show the names of people who have been on the negative side of debates at least twice.
"Schema (values (type))": people : People_ID (number) , District (text) , Name (text) , Party (text) , Age (number) | debate : Debate_ID (number) , Date (text) , Venue (text) , Num_of_Audience (number) | debate_people : Debate_ID (number) , Affirmative (number) , Negative (number) , If_Affirmative_Win (others) "Primary Keys": people : People_ID | debate : Debate_ID | debate_people : Debate_ID "Foreign Keys": debate_people : Negative equals people : People_ID | debate_people : Affirmative equals people : People_ID | debate_people : Debate_ID equals debate : Debate_ID
SELECT Name FROM people WHERE People_id NOT IN (SELECT Affirmative FROM debate_people)
List the names of people that have not been on the affirmative side of debates.
"Schema (values (type))": people : People_ID (number) , District (text) , Name (text) , Party (text) , Age (number) | debate : Debate_ID (number) , Date (text) , Venue (text) , Num_of_Audience (number) | debate_people : Debate_ID (number) , Affirmative (number) , Negative (number) , If_Affirmative_Win (others) "Primary Keys": people : People_ID | debate : Debate_ID | debate_people : Debate_ID "Foreign Keys": debate_people : Negative equals people : People_ID | debate_people : Affirmative equals people : People_ID | debate_people : Debate_ID equals debate : Debate_ID
SELECT customer_details FROM customers ORDER BY customer_details
List the names of all the customers in alphabetical order.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT customer_details FROM customers ORDER BY customer_details
Sort the customer names in alphabetical order.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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"
Find all the policy type codes associated with the customer "Dayana Robel"
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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"
What are the type codes of the policies used by the customer "Dayana Robel"?
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
Which type of policy is most frequently used? Give me the policy type code.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
Find the type code of the most frequently used policy.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*) > 2
Find all the policy types that are used by more than 2 customers.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*) > 2
Which types of policy are chosen by more than 2 customers? Give me the policy type codes.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT sum(amount_piad) , avg(amount_piad) FROM claim_headers
Find the total and average amount paid in claim headers.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT sum(amount_piad) , avg(amount_piad) FROM claim_headers
What are the total amount and average amount paid in claim headers?
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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)
Find the total amount claimed in the most recently created document.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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)
How much amount in total were claimed in the most recently created document?
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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)
What is the name of the customer who has made the largest amount of claim in a single claim?
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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)
Which customer made the largest amount of claim in a single claim? Return the customer details.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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)
What is the name of the customer who has made the minimum amount of payment in one claim?
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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)
Which customer made the smallest amount of claim in one claim? Return the customer details.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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
Find the names of customers who have no policies associated.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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
What are the names of customers who do not have any policies?
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT count(*) FROM claims_processing_stages
How many claim processing stages are there in total?
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT count(*) FROM claims_processing_stages
Find the number of distinct stages in claim processing.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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
What is the name of the claim processing stage that most of the claims are on?
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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
Which claim processing stage has the most claims? Show the claim status name.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%"
Find the names of customers whose name contains "Diana".
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%"
Which customers have the substring "Diana" in their names? Return the customer details.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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"
Find the names of the customers who have an deputy policy.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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"
Which customers have an insurance policy with the type code "Deputy"? Give me the customer details.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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"
Find the names of customers who either have an deputy policy or uniformed policy.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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"
Which customers have an insurance policy with the type code "Deputy" or "Uniform"? Return the customer details.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT customer_details FROM customers UNION SELECT staff_details FROM staff
Find the names of all the customers and staff members.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT customer_details FROM customers UNION SELECT staff_details FROM staff
What are the names of the customers and staff members?
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT policy_type_code , count(*) FROM policies GROUP BY policy_type_code
Find the number of records of each policy type and its type code.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT policy_type_code , count(*) FROM policies GROUP BY policy_type_code
For each policy type, return its type code and its count in the record.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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
Find the name of the customer that has been involved in the most policies.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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
Which customer have the most policies? Give me the customer details.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name = "Open"
What is the description of the claim status "Open"?
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name = "Open"
Find the description of the claim status "Open".
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT count(DISTINCT claim_outcome_code) FROM claims_processing
How many distinct claim outcome codes are there?
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT count(DISTINCT claim_outcome_code) FROM claims_processing
Count the number of distinct claim outcome codes.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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)
Which customer is associated with the latest policy?
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
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)
Find the customer who started a policy most recently.
"Schema (values (type))": Customers : Customer_ID (number) , Customer_Details (text) | Staff : Staff_ID (number) , Staff_Details (text) | Policies : Policy_ID (number) , Customer_ID (number) , Policy_Type_Code (text) , Start_Date (time) , End_Date (time) | Claim_Headers : Claim_Header_ID (number) , Claim_Status_Code (text) , Claim_Type_Code (text) , Policy_ID (number) , Date_of_Claim (time) , Date_of_Settlement (time) , Amount_Claimed (number) , Amount_Piad (number) | Claims_Documents : Claim_ID (number) , Document_Type_Code (text) , Created_by_Staff_ID (number) , Created_Date (number) | Claims_Processing_Stages : Claim_Stage_ID (number) , Next_Claim_Stage_ID (number) , Claim_Status_Name (text) , Claim_Status_Description (text) | Claims_Processing : Claim_Processing_ID (number) , Claim_ID (number) , Claim_Outcome_Code (text) , Claim_Stage_ID (number) , Staff_ID (number) "Primary Keys": Customers : Customer_ID | Staff : Staff_ID | Policies : Policy_ID | Claim_Headers : Claim_Header_ID | Claims_Documents : Claim_ID | Claims_Processing_Stages : Claim_Stage_ID | Claims_Processing : Claim_Processing_ID "Foreign Keys": Policies : Customer_ID equals Customers : Customer_ID | Claim_Headers : Policy_ID equals Policies : Policy_ID | Claims_Documents : Created_by_Staff_ID equals Staff : Staff_ID | Claims_Documents : Claim_ID equals Claim_Headers : Claim_Header_ID | Claims_Processing : Staff_ID equals Staff : Staff_ID | Claims_Processing : Claim_ID equals Claim_Headers : Claim_Header_ID
SELECT count(*) FROM Accounts
Show the number of accounts.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT count(*) FROM Accounts
How many accounts are there?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT count(DISTINCT customer_id) FROM Accounts
How many customers have opened an account?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT count(DISTINCT customer_id) FROM Accounts
Count the number of customers who have an account.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT account_id , date_account_opened , account_name , other_account_details FROM Accounts
Show the id, the date of account opened, the account name, and other account detail for all accounts.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT account_id , date_account_opened , account_name , other_account_details FROM Accounts
What are the ids, date opened, name, and other details for all accounts?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
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'
Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
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'
What are the ids, names, dates of opening, and other details for accounts corresponding to the customer with the first name "Meaghan"?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
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"
Show the account name and other account detail for all accounts by the customer with first name Meaghan and last name Keeling.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
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"
What are the names and other details for accounts corresponding to the customer named Meaghan Keeling?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
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"
Show the first name and last name for the customer with account name 900.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
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"
What are the full names of customers with the account name 900?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT count(*) FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts)
How many customers don't have an account?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT count(*) FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts)
Count the number of customers who do not have an account.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT DISTINCT T1.customer_first_name , T1.customer_last_name , T1.phone_number FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id
Show the unique first names, last names, and phone numbers for all customers with any account.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT DISTINCT T1.customer_first_name , T1.customer_last_name , T1.phone_number FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id
What are the distinct first names, last names, and phone numbers for customers with accounts?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts
Show customer ids who don't have an account.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts
What are the customer ids for customers who do not have an account?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT count(*) , customer_id FROM Accounts GROUP BY customer_id
How many accounts does each customer have? List the number and customer id.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT count(*) , customer_id FROM Accounts GROUP BY customer_id
Count the number of accounts corresponding to each customer id.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
What is the customer id, first and last name with most number of accounts.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
Return the id and full name of the customer with the most accounts.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name , count(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id
Show id, first name and last name for all customers and the number of accounts.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name , count(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id
What are the the full names and ids for all customers, and how many accounts does each have?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT T2.customer_first_name , T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2
Show first name and id for all customers with at least 2 accounts.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT T2.customer_first_name , T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2
What are the first names and ids for customers who have two or more accounts?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT count(*) FROM Customers
Show the number of customers.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT count(*) FROM Customers
Count the number of customers.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT gender , count(*) FROM Customers GROUP BY gender
Show the number of customers for each gender.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT gender , count(*) FROM Customers GROUP BY gender
How many customers are there of each gender?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT count(*) FROM Financial_transactions
How many transactions do we have?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT count(*) FROM Financial_transactions
Count the number of transactions.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT count(*) , account_id FROM Financial_transactions
How many transaction does each account have? Show the number and account id.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT count(*) , account_id FROM Financial_transactions
Count the number of financial transactions that correspond to each account id.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = "337"
How many transaction does account with name 337 have?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = "337"
Count the number of financial transactions that the account with the name 337 has.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT avg(transaction_amount) , min(transaction_amount) , max(transaction_amount) , sum(transaction_amount) FROM Financial_transactions
What is the average, minimum, maximum, and total transaction amount?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT avg(transaction_amount) , min(transaction_amount) , max(transaction_amount) , sum(transaction_amount) FROM Financial_transactions
Return the average, minimum, maximum, and total transaction amounts.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT transaction_id FROM Financial_transactions WHERE transaction_amount > (SELECT avg(transaction_amount) FROM Financial_transactions)
Show ids for all transactions whose amounts are greater than the average.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT transaction_id FROM Financial_transactions WHERE transaction_amount > (SELECT avg(transaction_amount) FROM Financial_transactions)
What are the ids for transactions that have an amount greater than the average amount of a transaction?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT transaction_type , sum(transaction_amount) FROM Financial_transactions GROUP BY transaction_type
Show the transaction types and the total amount of transactions.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT transaction_type , sum(transaction_amount) FROM Financial_transactions GROUP BY transaction_type
What are total transaction amounts for each transaction type?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT T2.account_name , T1.account_id , count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id
Show the account name, id and the number of transactions for each account.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT T2.account_name , T1.account_id , count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id
Return the names and ids of each account, as well as the number of transactions.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT account_id FROM Financial_transactions GROUP BY account_id ORDER BY count(*) DESC LIMIT 1
Show the account id with most number of transactions.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT account_id FROM Financial_transactions GROUP BY account_id ORDER BY count(*) DESC LIMIT 1
What is the id of the account with the most transactions?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT T1.account_id , T2.account_name FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id HAVING count(*) >= 4
Show the account id and name with at least 4 transactions.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT T1.account_id , T2.account_name FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id HAVING count(*) >= 4
What are the ids and names of accounts with 4 or more transactions?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT DISTINCT product_size FROM Products
Show all product sizes.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT DISTINCT product_size FROM Products
What are the different product sizes?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT DISTINCT product_color FROM Products
Show all product colors.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT DISTINCT product_color FROM Products
What are the different product colors?
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id
SELECT invoice_number , count(*) FROM Financial_transactions GROUP BY invoice_number
Show the invoice number and the number of transactions for each invoice.
"Schema (values (type))": Customers : customer_id (number) , 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 (number) , customer_id (number) , date_order_placed (time) , order_details (text) | Invoices : invoice_number (number) , order_id (number) , invoice_date (time) | Accounts : account_id (number) , customer_id (number) , date_account_opened (time) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (text) , vat_rating (number) | Products : product_id (number) , parent_product_id (number) , production_type_code (text) , unit_price (number) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (number) , account_id (number) , invoice_number (number) , transaction_type (text) , transaction_date (time) , transaction_amount (number) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (number) , order_id (number) , product_id (number) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (number) , invoice_number (number) , product_id (number) , product_title (text) , product_quantity (text) , product_price (number) , derived_product_cost (number) , derived_vat_payable (number) , derived_total_cost (number) "Primary Keys": Customers : customer_id | Orders : order_id | Invoices : invoice_number | Accounts : account_id | Product_Categories : production_type_code | Products : product_id | Order_Items : order_item_id "Foreign Keys": Orders : customer_id equals Customers : customer_id | Invoices : order_id equals Orders : order_id | Accounts : customer_id equals Customers : customer_id | Products : production_type_code equals Product_Categories : production_type_code | Financial_Transactions : account_id equals Accounts : account_id | Financial_Transactions : invoice_number equals Invoices : invoice_number | Order_Items : order_id equals Orders : order_id | Order_Items : product_id equals Products : product_id | Invoice_Line_Items : product_id equals Products : product_id | Invoice_Line_Items : invoice_number equals Invoices : invoice_number | Invoice_Line_Items : order_item_id equals Order_Items : order_item_id