db_id stringlengths 4 31 | SQL stringlengths 18 1.45k | input_sequence stringlengths 148 11k | question stringlengths 16 325 |
|---|---|---|---|
debate | select distinct venue from debate | Question: show the distinct venues of debates | Tables: people -> People_ID, District, Name, Party, Age. debate -> Debate_ID, Date, Venue, Num_of_Audience. debate_people -> Debate_ID, Affirmative, Negative, If_Affirmative_Win. | Joins: debate_people.Negative = people.People_ID, debate_people.Affirmative = people.People... | show the distinct venues of debates |
debate | 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 | Question: show the names of people, and dates and venues of debates they are on the affirmative side. | Tables: people -> People_ID, District, Name, Party, Age. debate -> Debate_ID, Date, Venue, Num_of_Audience. debate_people -> Debate_ID, Affirmative, Negative, If_Affirmative_Win. | Joins: debate_people.Negative = peo... | show the names of people, and dates and venues of debates they are on the affirmative side. |
debate | 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 | Question: show the names of people, and dates and venues of debates they are on the negative side, ordered in ascending alphabetical order of name. | Tables: people -> People_ID, District, Name, Party, Age. debate -> Debate_ID, Date, Venue, Num_of_Audience. debate_people -> Debate_ID, Affirmative, Negative, If_Affirmat... | show the names of people, and dates and venues of debates they are on the negative side, ordered in ascending alphabetical order of name. |
debate | 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 | Question: show the names of people that are on affirmative side of debates with number of audience bigger than 200. | Tables: people -> People_ID, District, Name, Party, Age. debate -> Debate_ID, Date, Venue, Num_of_Audience. debate_people -> Debate_ID, Affirmative, Negative, If_Affirmative_Win. | Joins: debate_people.... | show the names of people that are on affirmative side of debates with number of audience bigger than 200. |
debate | select t2.name , count(*) from debate_people as t1 join people as t2 on t1.affirmative = t2.people_id group by t2.name | Question: show the names of people and the number of times they have been on the affirmative side of debates. | Tables: people -> People_ID, District, Name, Party, Age. debate -> Debate_ID, Date, Venue, Num_of_Audience. debate_people -> Debate_ID, Affirmative, Negative, If_Affirmative_Win. | Joins: debate_people.Negati... | show the names of people and the number of times they have been on the affirmative side of debates. |
debate | 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 | Question: show the names of people who have been on the negative side of debates at least twice. | Tables: people -> People_ID, District, Name, Party, Age. debate -> Debate_ID, Date, Venue, Num_of_Audience. debate_people -> Debate_ID, Affirmative, Negative, If_Affirmative_Win. | Joins: debate_people.Negative = people.P... | show the names of people who have been on the negative side of debates at least twice. |
debate | select name from people where people_id not in (select affirmative from debate_people) | Question: list the names of people that have not been on the affirmative side of debates. | Tables: people -> People_ID, District, Name, Party, Age. debate -> Debate_ID, Date, Venue, Num_of_Audience. debate_people -> Debate_ID, Affirmative, Negative, If_Affirmative_Win. | Joins: debate_people.Negative = people.People_I... | list the names of people that have not been on the affirmative side of debates. |
insurance_and_eClaims | select customer_details from customers order by customer_details | Question: list the names of all the customers in alphabetical order. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_o... | list the names of all the customers in alphabetical order. |
insurance_and_eClaims | select customer_details from customers order by customer_details | Question: sort the customer names in alphabetical order. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Claim, Dat... | sort the customer names in alphabetical order. |
insurance_and_eClaims | 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' | Question: find all the policy type codes associated with the customer 'dayana robel' | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, P... | find all the policy type codes associated with the customer 'dayana robel' |
insurance_and_eClaims | 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' | Question: what are the type codes of the policies used by the customer 'dayana robel'? | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code,... | what are the type codes of the policies used by the customer 'dayana robel'? |
insurance_and_eClaims | select policy_type_code from policies group by policy_type_code order by count(*) desc limit 1 | Question: which type of policy is most frequently used? give me the policy type code. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, ... | which type of policy is most frequently used? give me the policy type code. |
insurance_and_eClaims | select policy_type_code from policies group by policy_type_code order by count(*) desc limit 1 | Question: find the type code of the most frequently used policy. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Cl... | find the type code of the most frequently used policy. |
insurance_and_eClaims | select policy_type_code from policies group by policy_type_code having count(*) > 2 | Question: find all the policy types that are used by more than 2 customers. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID,... | find all the policy types that are used by more than 2 customers. |
insurance_and_eClaims | select policy_type_code from policies group by policy_type_code having count(*) > 2 | Question: which types of policy are chosen by more than 2 customers? give me the policy type codes. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Cla... | which types of policy are chosen by more than 2 customers? give me the policy type codes. |
insurance_and_eClaims | select sum(amount_piad) , avg(amount_piad) from claim_headers | Question: find the total and average amount paid in claim headers. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_... | find the total and average amount paid in claim headers. |
insurance_and_eClaims | select sum(amount_piad) , avg(amount_piad) from claim_headers | Question: what are the total amount and average amount paid in claim headers? | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_I... | what are the total amount and average amount paid in claim headers? |
insurance_and_eClaims | 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) | Question: find the total amount claimed in the most recently created document. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_... | find the total amount claimed in the most recently created document. |
insurance_and_eClaims | 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) | Question: how much amount in total were claimed in the most recently created document? | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code,... | how much amount in total were claimed in the most recently created document? |
insurance_and_eClaims | 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) | Question: what is the name of the customer who has made the largest amount of claim in a single claim? | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, ... | what is the name of the customer who has made the largest amount of claim in a single claim? |
insurance_and_eClaims | 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) | Question: which customer made the largest amount of claim in a single claim? return the customer details. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Cod... | which customer made the largest amount of claim in a single claim? return the customer details. |
insurance_and_eClaims | 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) | Question: what is the name of the customer who has made the minimum amount of payment in one claim? | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Cla... | what is the name of the customer who has made the minimum amount of payment in one claim? |
insurance_and_eClaims | 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) | Question: which customer made the smallest amount of claim in one claim? return the customer details. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, C... | which customer made the smallest amount of claim in one claim? return the customer details. |
insurance_and_eClaims | 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 | Question: find the names of customers who have no policies associated. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date... | find the names of customers who have no policies associated. |
insurance_and_eClaims | 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 | Question: what are the names of customers who do not have any policies? | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Dat... | what are the names of customers who do not have any policies? |
insurance_and_eClaims | select count(*) from claims_processing_stages | Question: how many claim processing stages are there in total? | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Clai... | how many claim processing stages are there in total? |
insurance_and_eClaims | select count(*) from claims_processing_stages | Question: find the number of distinct stages in claim processing. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_C... | find the number of distinct stages in claim processing. |
insurance_and_eClaims | 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 | Question: what is the name of the claim processing stage that most of the claims are on? | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Cod... | what is the name of the claim processing stage that most of the claims are on? |
insurance_and_eClaims | 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 | Question: which claim processing stage has the most claims? show the claim status name. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code... | which claim processing stage has the most claims? show the claim status name. |
insurance_and_eClaims | select customer_details from customers where customer_details like '%diana%' | Question: find the names of customers whose name contains 'diana'. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_... | find the names of customers whose name contains 'diana'. |
insurance_and_eClaims | select customer_details from customers where customer_details like '%diana%' | Question: which customers have the substring 'diana' in their names? return the customer details. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim... | which customers have the substring 'diana' in their names? return the customer details. |
insurance_and_eClaims | 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' | Question: find the names of the customers who have an deputy policy. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_o... | find the names of the customers who have an deputy policy. |
insurance_and_eClaims | 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' | Question: which customers have an insurance policy with the type code 'deputy'? give me the customer details. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status... | which customers have an insurance policy with the type code 'deputy'? give me the customer details. |
insurance_and_eClaims | 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' | Question: find the names of customers who either have an deputy policy or uniformed policy. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_... | find the names of customers who either have an deputy policy or uniformed policy. |
insurance_and_eClaims | 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' | Question: which customers have an insurance policy with the type code 'deputy' or 'uniform'? return the customer details. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, ... | which customers have an insurance policy with the type code 'deputy' or 'uniform'? return the customer details. |
insurance_and_eClaims | select customer_details from customers union select staff_details from staff | Question: find the names of all the customers and staff members. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Cl... | find the names of all the customers and staff members. |
insurance_and_eClaims | select customer_details from customers union select staff_details from staff | Question: what are the names of the customers and staff members? | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Cl... | what are the names of the customers and staff members? |
insurance_and_eClaims | select policy_type_code , count(*) from policies group by policy_type_code | Question: find the number of records of each policy type and its type code. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID,... | find the number of records of each policy type and its type code. |
insurance_and_eClaims | select policy_type_code , count(*) from policies group by policy_type_code | Question: for each policy type, return its type code and its count in the record. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Poli... | for each policy type, return its type code and its count in the record. |
insurance_and_eClaims | 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 | Question: find the name of the customer that has been involved in the most policies. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, P... | find the name of the customer that has been involved in the most policies. |
insurance_and_eClaims | 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 | Question: which customer have the most policies? give me the customer details. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_... | which customer have the most policies? give me the customer details. |
insurance_and_eClaims | select claim_status_description from claims_processing_stages where claim_status_name = 'open' | Question: what is the description of the claim status 'open'? | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Claim... | what is the description of the claim status 'open'? |
insurance_and_eClaims | select claim_status_description from claims_processing_stages where claim_status_name = 'open' | Question: find the description of the claim status 'open'. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Claim, D... | find the description of the claim status 'open'. |
insurance_and_eClaims | select count(distinct claim_outcome_code) from claims_processing | Question: how many distinct claim outcome codes are there? | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Claim, D... | how many distinct claim outcome codes are there? |
insurance_and_eClaims | select count(distinct claim_outcome_code) from claims_processing | Question: count the number of distinct claim outcome codes. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Claim, ... | count the number of distinct claim outcome codes. |
insurance_and_eClaims | 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) | Question: which customer is associated with the latest policy? | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Clai... | which customer is associated with the latest policy? |
insurance_and_eClaims | 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) | Question: find the customer who started a policy most recently. | Tables: Customers -> Customer_ID, Customer_Details. Staff -> Staff_ID, Staff_Details. Policies -> Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date. Claim_Headers -> Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Cla... | find the customer who started a policy most recently. |
customers_and_invoices | select count(*) from accounts | Question: show the number of accounts. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_placed, order_details. Invo... | show the number of accounts. |
customers_and_invoices | select count(*) from accounts | Question: how many accounts are there? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_placed, order_details. Invo... | how many accounts are there? |
customers_and_invoices | select count(distinct customer_id) from accounts | Question: how many customers have opened an account? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_placed, order... | how many customers have opened an account? |
customers_and_invoices | select count(distinct customer_id) from accounts | Question: count the number of customers who have an account. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_place... | count the number of customers who have an account. |
customers_and_invoices | select account_id , date_account_opened , account_name , other_account_details from accounts | Question: show the id, the date of account opened, the account name, and other account detail for all accounts. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country... | show the id, the date of account opened, the account name, and other account detail for all accounts. |
customers_and_invoices | select account_id , date_account_opened , account_name , other_account_details from accounts | Question: what are the ids, date opened, name, and other details for all accounts? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, custome... | what are the ids, date opened, name, and other details for all accounts? |
customers_and_invoices | 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' | Question: show the id, the account name, and other account details for all accounts by the customer with first name 'meaghan'. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_pr... | show the id, the account name, and other account details for all accounts by the customer with first name 'meaghan'. |
customers_and_invoices | 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' | Question: what are the ids, names, dates of opening, and other details for accounts corresponding to the customer with the first name 'meaghan'? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_cit... | what are the ids, names, dates of opening, and other details for accounts corresponding to the customer with the first name 'meaghan'? |
customers_and_invoices | 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' | Question: show the account name and other account detail for all accounts by the customer with first name meaghan and last name keeling. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state... | show the account name and other account detail for all accounts by the customer with first name meaghan and last name keeling. |
customers_and_invoices | 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' | Question: what are the names and other details for accounts corresponding to the customer named meaghan keeling? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, countr... | what are the names and other details for accounts corresponding to the customer named meaghan keeling? |
customers_and_invoices | 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' | Question: show the first name and last name for the customer with account name 900. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, custom... | show the first name and last name for the customer with account name 900. |
customers_and_invoices | 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' | Question: what are the full names of customers with the account name 900? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, dat... | what are the full names of customers with the account name 900? |
customers_and_invoices | select count(*) from customers where customer_id not in (select customer_id from accounts) | Question: how many customers don't have an account? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_placed, order_... | how many customers don't have an account? |
customers_and_invoices | select count(*) from customers where customer_id not in (select customer_id from accounts) | Question: count the number of customers who do not have an account. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_orde... | count the number of customers who do not have an account. |
customers_and_invoices | 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 | Question: show the unique first names, last names, and phone numbers for all customers with any account. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Order... | show the unique first names, last names, and phone numbers for all customers with any account. |
customers_and_invoices | 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 | Question: what are the distinct first names, last names, and phone numbers for customers with accounts? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders... | what are the distinct first names, last names, and phone numbers for customers with accounts? |
customers_and_invoices | select customer_id from customers except select customer_id from accounts | Question: show customer ids who don't have an account. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_placed, ord... | show customer ids who don't have an account. |
customers_and_invoices | select customer_id from customers except select customer_id from accounts | Question: what are the customer ids for customers who do not have an account? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id,... | what are the customer ids for customers who do not have an account? |
customers_and_invoices | select count(*) , customer_id from accounts group by customer_id | Question: how many accounts does each customer have? list the number and customer id. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, cust... | how many accounts does each customer have? list the number and customer id. |
customers_and_invoices | select count(*) , customer_id from accounts group by customer_id | Question: count the number of accounts corresponding to each customer id. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, dat... | count the number of accounts corresponding to each customer id. |
customers_and_invoices | 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 | Question: what is the customer id, first and last name with most number of accounts. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, custo... | what is the customer id, first and last name with most number of accounts. |
customers_and_invoices | 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 | Question: return the id and full name of the customer with the most accounts. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id,... | return the id and full name of the customer with the most accounts. |
customers_and_invoices | 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 | Question: show id, first name and last name for all customers and the number of accounts. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, ... | show id, first name and last name for all customers and the number of accounts. |
customers_and_invoices | 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 | Question: what are the the full names and ids for all customers, and how many accounts does each have? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders ... | what are the the full names and ids for all customers, and how many accounts does each have? |
customers_and_invoices | 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 | Question: show first name and id for all customers with at least 2 accounts. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, ... | show first name and id for all customers with at least 2 accounts. |
customers_and_invoices | 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 | Question: what are the first names and ids for customers who have two or more accounts? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, cu... | what are the first names and ids for customers who have two or more accounts? |
customers_and_invoices | select count(*) from customers | Question: show the number of customers. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_placed, order_details. Inv... | show the number of customers. |
customers_and_invoices | select count(*) from customers | Question: count the number of customers. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_placed, order_details. In... | count the number of customers. |
customers_and_invoices | select gender , count(*) from customers group by gender | Question: show the number of customers for each gender. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_placed, or... | show the number of customers for each gender. |
customers_and_invoices | select gender , count(*) from customers group by gender | Question: how many customers are there of each gender? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_placed, ord... | how many customers are there of each gender? |
customers_and_invoices | select count(*) from financial_transactions | Question: how many transactions do we have? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_placed, order_details.... | how many transactions do we have? |
customers_and_invoices | select count(*) from financial_transactions | Question: count the number of transactions. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_placed, order_details.... | count the number of transactions. |
customers_and_invoices | select count(*) , account_id from financial_transactions | Question: how many transaction does each account have? show the number and account id. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, cus... | how many transaction does each account have? show the number and account id. |
customers_and_invoices | select count(*) , account_id from financial_transactions | Question: count the number of financial transactions that correspond to each account id. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, c... | count the number of financial transactions that correspond to each account id. |
customers_and_invoices | select count(*) from financial_transactions as t1 join accounts as t2 on t1.account_id = t2.account_id where t2.account_name = '337' | Question: how many transaction does account with name 337 have? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_pl... | how many transaction does account with name 337 have? |
customers_and_invoices | select count(*) from financial_transactions as t1 join accounts as t2 on t1.account_id = t2.account_id where t2.account_name = '337' | Question: count the number of financial transactions that the account with the name 337 has. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_i... | count the number of financial transactions that the account with the name 337 has. |
customers_and_invoices | select avg(transaction_amount) , min(transaction_amount) , max(transaction_amount) , sum(transaction_amount) from financial_transactions | Question: what is the average, minimum, maximum, and total transaction amount? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id... | what is the average, minimum, maximum, and total transaction amount? |
customers_and_invoices | select avg(transaction_amount) , min(transaction_amount) , max(transaction_amount) , sum(transaction_amount) from financial_transactions | Question: return the average, minimum, maximum, and total transaction amounts. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id... | return the average, minimum, maximum, and total transaction amounts. |
customers_and_invoices | select transaction_id from financial_transactions where transaction_amount > (select avg(transaction_amount) from financial_transactions) | Question: show ids for all transactions whose amounts are greater than the average. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, custom... | show ids for all transactions whose amounts are greater than the average. |
customers_and_invoices | select transaction_id from financial_transactions where transaction_amount > (select avg(transaction_amount) from financial_transactions) | Question: what are the ids for transactions that have an amount greater than the average amount of a transaction? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, count... | what are the ids for transactions that have an amount greater than the average amount of a transaction? |
customers_and_invoices | select transaction_type , sum(transaction_amount) from financial_transactions group by transaction_type | Question: show the transaction types and the total amount of transactions. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, da... | show the transaction types and the total amount of transactions. |
customers_and_invoices | select transaction_type , sum(transaction_amount) from financial_transactions group by transaction_type | Question: what are total transaction amounts for each transaction type? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_... | what are total transaction amounts for each transaction type? |
customers_and_invoices | 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 | Question: show the account name, id and the number of transactions for each account. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, custo... | show the account name, id and the number of transactions for each account. |
customers_and_invoices | 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 | Question: return the names and ids of each account, as well as the number of transactions. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id,... | return the names and ids of each account, as well as the number of transactions. |
customers_and_invoices | select account_id from financial_transactions group by account_id order by count(*) desc limit 1 | Question: show the account id with most number of transactions. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_pl... | show the account id with most number of transactions. |
customers_and_invoices | select account_id from financial_transactions group by account_id order by count(*) desc limit 1 | Question: what is the id of the account with the most transactions? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_orde... | what is the id of the account with the most transactions? |
customers_and_invoices | 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 | Question: show the account id and name with at least 4 transactions. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_ord... | show the account id and name with at least 4 transactions. |
customers_and_invoices | 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 | Question: what are the ids and names of accounts with 4 or more transactions? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id,... | what are the ids and names of accounts with 4 or more transactions? |
customers_and_invoices | select distinct product_size from products | Question: show all product sizes. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_placed, order_details. Invoices ... | show all product sizes. |
customers_and_invoices | select distinct product_size from products | Question: what are the different product sizes? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_placed, order_deta... | what are the different product sizes? |
customers_and_invoices | select distinct product_color from products | Question: show all product colors. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_placed, order_details. Invoices... | show all product colors. |
customers_and_invoices | select distinct product_color from products | Question: what are the different product colors? | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, customer_id, date_order_placed, order_det... | what are the different product colors? |
customers_and_invoices | select invoice_number , count(*) from financial_transactions group by invoice_number | Question: show the invoice number and the number of transactions for each invoice. | Tables: Customers -> customer_id, customer_first_name, customer_middle_initial, customer_last_name, gender, email_address, login_name, login_password, phone_number, town_city, state_county_province, country. Orders -> order_id, custome... | show the invoice number and the number of transactions for each invoice. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.