input
stringlengths
667
7.62k
output
stringlengths
41
600
db_id
stringlengths
3
31
query
stringlengths
18
577
question
stringlengths
3
224
schema
stringlengths
177
6.14k
primary_keys
stringlengths
16
545
foreign_keys
stringlengths
16
1.48k
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | debate | people : people_id (text) , district (number) , name (text) , party (text) , age (text) | debate : debate_id (text) , date (number) , venue (text) , num_of_audience (text) | debate_people : debate_id (text) , affirmative (number) , negative (text) , if_affirmative_win (text);</schema>" <primary_keys>[Primary Keys]: people : people_id, debate : debate_id, debate_people : debate_id</primary_keys>" <foreign_keys>[Foreign Keys]: debate_people : negative = people : people_id | debate_people : affirmative = people : people_id | debate_people : debate_id = debate : debate_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the distinct venues of debates</question> [SQL]:
<SQL_QUERY>SELECT DISTINCT Venue FROM debate</SQL_QUERY>
debate
SELECT DISTINCT Venue FROM debate
Show the distinct venues of debates
[Schema (values) (types)]: | debate | people : people_id (text) , district (number) , name (text) , party (text) , age (text) | debate : debate_id (text) , date (number) , venue (text) , num_of_audience (text) | debate_people : debate_id (text) , affirmative (number) , negative (text) , if_affirmative_win (text);
[Primary Keys]: people : people_id, debate : debate_id, debate_people : debate_id
[Foreign Keys]: debate_people : negative = people : people_id | debate_people : affirmative = people : people_id | debate_people : debate_id = debate : debate_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | debate | people : people_id (text) , district (number) , name (text) , party (text) , age (text) | debate : debate_id (text) , date (number) , venue (text) , num_of_audience (text) | debate_people : debate_id (text) , affirmative (number) , negative (text) , if_affirmative_win (text);</schema>" <primary_keys>[Primary Keys]: people : people_id, debate : debate_id, debate_people : debate_id</primary_keys>" <foreign_keys>[Foreign Keys]: debate_people : negative = people : people_id | debate_people : affirmative = people : people_id | debate_people : debate_id = debate : debate_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the names of people, and dates and venues of debates they are on the affirmative side.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
Show the names of people, and dates and venues of debates they are on the affirmative side.
[Schema (values) (types)]: | debate | people : people_id (text) , district (number) , name (text) , party (text) , age (text) | debate : debate_id (text) , date (number) , venue (text) , num_of_audience (text) | debate_people : debate_id (text) , affirmative (number) , negative (text) , if_affirmative_win (text);
[Primary Keys]: people : people_id, debate : debate_id, debate_people : debate_id
[Foreign Keys]: debate_people : negative = people : people_id | debate_people : affirmative = people : people_id | debate_people : debate_id = debate : debate_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | debate | people : people_id (text) , district (number) , name (text) , party (text) , age (text) | debate : debate_id (text) , date (number) , venue (text) , num_of_audience (text) | debate_people : debate_id (text) , affirmative (number) , negative (text) , if_affirmative_win (text);</schema>" <primary_keys>[Primary Keys]: people : people_id, debate : debate_id, debate_people : debate_id</primary_keys>" <foreign_keys>[Foreign Keys]: debate_people : negative = people : people_id | debate_people : affirmative = people : people_id | debate_people : debate_id = debate : debate_id</foreign_keys>" Answer the following question with a SQL Statement:<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.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
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) (types)]: | debate | people : people_id (text) , district (number) , name (text) , party (text) , age (text) | debate : debate_id (text) , date (number) , venue (text) , num_of_audience (text) | debate_people : debate_id (text) , affirmative (number) , negative (text) , if_affirmative_win (text);
[Primary Keys]: people : people_id, debate : debate_id, debate_people : debate_id
[Foreign Keys]: debate_people : negative = people : people_id | debate_people : affirmative = people : people_id | debate_people : debate_id = debate : debate_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | debate | people : people_id (text) , district (number) , name (text) , party (text) , age (text) | debate : debate_id (text) , date (number) , venue (text) , num_of_audience (text) | debate_people : debate_id (text) , affirmative (number) , negative (text) , if_affirmative_win (text);</schema>" <primary_keys>[Primary Keys]: people : people_id, debate : debate_id, debate_people : debate_id</primary_keys>" <foreign_keys>[Foreign Keys]: debate_people : negative = people : people_id | debate_people : affirmative = people : people_id | debate_people : debate_id = debate : debate_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the names of people that are on affirmative side of debates with number of audience bigger than 200.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
Show the names of people that are on affirmative side of debates with number of audience bigger than 200.
[Schema (values) (types)]: | debate | people : people_id (text) , district (number) , name (text) , party (text) , age (text) | debate : debate_id (text) , date (number) , venue (text) , num_of_audience (text) | debate_people : debate_id (text) , affirmative (number) , negative (text) , if_affirmative_win (text);
[Primary Keys]: people : people_id, debate : debate_id, debate_people : debate_id
[Foreign Keys]: debate_people : negative = people : people_id | debate_people : affirmative = people : people_id | debate_people : debate_id = debate : debate_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | debate | people : people_id (text) , district (number) , name (text) , party (text) , age (text) | debate : debate_id (text) , date (number) , venue (text) , num_of_audience (text) | debate_people : debate_id (text) , affirmative (number) , negative (text) , if_affirmative_win (text);</schema>" <primary_keys>[Primary Keys]: people : people_id, debate : debate_id, debate_people : debate_id</primary_keys>" <foreign_keys>[Foreign Keys]: debate_people : negative = people : people_id | debate_people : affirmative = people : people_id | debate_people : debate_id = debate : debate_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the names of people and the number of times they have been on the affirmative side of debates.</question> [SQL]:
<SQL_QUERY>SELECT T2.Name , COUNT(*) FROM debate_people AS T1 JOIN people AS T2 ON T1.Affirmative = T2.People_ID GROUP BY T2.Name</SQL_QUERY>
debate
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) (types)]: | debate | people : people_id (text) , district (number) , name (text) , party (text) , age (text) | debate : debate_id (text) , date (number) , venue (text) , num_of_audience (text) | debate_people : debate_id (text) , affirmative (number) , negative (text) , if_affirmative_win (text);
[Primary Keys]: people : people_id, debate : debate_id, debate_people : debate_id
[Foreign Keys]: debate_people : negative = people : people_id | debate_people : affirmative = people : people_id | debate_people : debate_id = debate : debate_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | debate | people : people_id (text) , district (number) , name (text) , party (text) , age (text) | debate : debate_id (text) , date (number) , venue (text) , num_of_audience (text) | debate_people : debate_id (text) , affirmative (number) , negative (text) , if_affirmative_win (text);</schema>" <primary_keys>[Primary Keys]: people : people_id, debate : debate_id, debate_people : debate_id</primary_keys>" <foreign_keys>[Foreign Keys]: debate_people : negative = people : people_id | debate_people : affirmative = people : people_id | debate_people : debate_id = debate : debate_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the names of people who have been on the negative side of debates at least twice.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
Show the names of people who have been on the negative side of debates at least twice.
[Schema (values) (types)]: | debate | people : people_id (text) , district (number) , name (text) , party (text) , age (text) | debate : debate_id (text) , date (number) , venue (text) , num_of_audience (text) | debate_people : debate_id (text) , affirmative (number) , negative (text) , if_affirmative_win (text);
[Primary Keys]: people : people_id, debate : debate_id, debate_people : debate_id
[Foreign Keys]: debate_people : negative = people : people_id | debate_people : affirmative = people : people_id | debate_people : debate_id = debate : debate_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | debate | people : people_id (text) , district (number) , name (text) , party (text) , age (text) | debate : debate_id (text) , date (number) , venue (text) , num_of_audience (text) | debate_people : debate_id (text) , affirmative (number) , negative (text) , if_affirmative_win (text);</schema>" <primary_keys>[Primary Keys]: people : people_id, debate : debate_id, debate_people : debate_id</primary_keys>" <foreign_keys>[Foreign Keys]: debate_people : negative = people : people_id | debate_people : affirmative = people : people_id | debate_people : debate_id = debate : debate_id</foreign_keys>" Answer the following question with a SQL Statement:<question>List the names of people that have not been on the affirmative side of debates.</question> [SQL]:
<SQL_QUERY>SELECT Name FROM people WHERE People_id NOT IN (SELECT Affirmative FROM debate_people)</SQL_QUERY>
debate
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) (types)]: | debate | people : people_id (text) , district (number) , name (text) , party (text) , age (text) | debate : debate_id (text) , date (number) , venue (text) , num_of_audience (text) | debate_people : debate_id (text) , affirmative (number) , negative (text) , if_affirmative_win (text);
[Primary Keys]: people : people_id, debate : debate_id, debate_people : debate_id
[Foreign Keys]: debate_people : negative = people : people_id | debate_people : affirmative = people : people_id | debate_people : debate_id = debate : debate_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>List the names of all the customers in alphabetical order.</question> [SQL]:
<SQL_QUERY>SELECT customer_details FROM customers ORDER BY customer_details</SQL_QUERY>
insurance_and_eClaims
SELECT customer_details FROM customers ORDER BY customer_details
List the names of all the customers in alphabetical order.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Sort the customer names in alphabetical order.</question> [SQL]:
<SQL_QUERY>SELECT customer_details FROM customers ORDER BY customer_details</SQL_QUERY>
insurance_and_eClaims
SELECT customer_details FROM customers ORDER BY customer_details
Sort the customer names in alphabetical order.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Find all the policy type codes associated with the customer "Dayana Robel"</question> [SQL]:
<SQL_QUERY>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"</SQL_QUERY>
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"
Find all the policy type codes associated with the customer "Dayana Robel"
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the type codes of the policies used by the customer "Dayana Robel"?</question> [SQL]:
<SQL_QUERY>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"</SQL_QUERY>
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"
What are the type codes of the policies used by the customer "Dayana Robel"?
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Which type of policy is most frequently used? Give me the policy type code.</question> [SQL]:
<SQL_QUERY>SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1</SQL_QUERY>
insurance_and_eClaims
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) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Find the type code of the most frequently used policy.</question> [SQL]:
<SQL_QUERY>SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1</SQL_QUERY>
insurance_and_eClaims
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) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Find all the policy types that are used by more than 2 customers.</question> [SQL]:
<SQL_QUERY>SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*) > 2</SQL_QUERY>
insurance_and_eClaims
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) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Which types of policy are chosen by more than 2 customers? Give me the policy type codes.</question> [SQL]:
<SQL_QUERY>SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*) > 2</SQL_QUERY>
insurance_and_eClaims
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) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Find the total and average amount paid in claim headers.</question> [SQL]:
<SQL_QUERY>SELECT sum(amount_piad) , avg(amount_piad) FROM claim_headers</SQL_QUERY>
insurance_and_eClaims
SELECT sum(amount_piad) , avg(amount_piad) FROM claim_headers
Find the total and average amount paid in claim headers.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the total amount and average amount paid in claim headers?</question> [SQL]:
<SQL_QUERY>SELECT sum(amount_piad) , avg(amount_piad) FROM claim_headers</SQL_QUERY>
insurance_and_eClaims
SELECT sum(amount_piad) , avg(amount_piad) FROM claim_headers
What are the total amount and average amount paid in claim headers?
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Find the total amount claimed in the most recently created document.</question> [SQL]:
<SQL_QUERY>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)</SQL_QUERY>
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)
Find the total amount claimed in the most recently created document.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>How much amount in total were claimed in the most recently created document?</question> [SQL]:
<SQL_QUERY>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)</SQL_QUERY>
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)
How much amount in total were claimed in the most recently created document?
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What is the name of the customer who has made the largest amount of claim in a single claim?</question> [SQL]:
<SQL_QUERY>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)</SQL_QUERY>
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)
What is the name of the customer who has made the largest amount of claim in a single claim?
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Which customer made the largest amount of claim in a single claim? Return the customer details.</question> [SQL]:
<SQL_QUERY>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)</SQL_QUERY>
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)
Which customer made the largest amount of claim in a single claim? Return the customer details.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What is the name of the customer who has made the minimum amount of payment in one claim?</question> [SQL]:
<SQL_QUERY>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)</SQL_QUERY>
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)
What is the name of the customer who has made the minimum amount of payment in one claim?
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Which customer made the smallest amount of claim in one claim? Return the customer details.</question> [SQL]:
<SQL_QUERY>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)</SQL_QUERY>
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)
Which customer made the smallest amount of claim in one claim? Return the customer details.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Find the names of customers who have no policies associated.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
Find the names of customers who have no policies associated.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the names of customers who do not have any policies?</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
What are the names of customers who do not have any policies?
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>How many claim processing stages are there in total?</question> [SQL]:
<SQL_QUERY>SELECT count(*) FROM claims_processing_stages</SQL_QUERY>
insurance_and_eClaims
SELECT count(*) FROM claims_processing_stages
How many claim processing stages are there in total?
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Find the number of distinct stages in claim processing.</question> [SQL]:
<SQL_QUERY>SELECT count(*) FROM claims_processing_stages</SQL_QUERY>
insurance_and_eClaims
SELECT count(*) FROM claims_processing_stages
Find the number of distinct stages in claim processing.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What is the name of the claim processing stage that most of the claims are on?</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
What is the name of the claim processing stage that most of the claims are on?
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Which claim processing stage has the most claims? Show the claim status name.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
Which claim processing stage has the most claims? Show the claim status name.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Find the names of customers whose name contains "Diana".</question> [SQL]:
<SQL_QUERY>SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%"</SQL_QUERY>
insurance_and_eClaims
SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%"
Find the names of customers whose name contains "Diana".
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Which customers have the substring "Diana" in their names? Return the customer details.</question> [SQL]:
<SQL_QUERY>SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%"</SQL_QUERY>
insurance_and_eClaims
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) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Find the names of the customers who have an deputy policy.</question> [SQL]:
<SQL_QUERY>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"</SQL_QUERY>
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"
Find the names of the customers who have an deputy policy.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Which customers have an insurance policy with the type code "Deputy"? Give me the customer details.</question> [SQL]:
<SQL_QUERY>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"</SQL_QUERY>
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"
Which customers have an insurance policy with the type code "Deputy"? Give me the customer details.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Find the names of customers who either have an deputy policy or uniformed policy.</question> [SQL]:
<SQL_QUERY>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"</SQL_QUERY>
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"
Find the names of customers who either have an deputy policy or uniformed policy.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Which customers have an insurance policy with the type code "Deputy" or "Uniform"? Return the customer details.</question> [SQL]:
<SQL_QUERY>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"</SQL_QUERY>
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"
Which customers have an insurance policy with the type code "Deputy" or "Uniform"? Return the customer details.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Find the names of all the customers and staff members.</question> [SQL]:
<SQL_QUERY>SELECT customer_details FROM customers UNION SELECT staff_details FROM staff</SQL_QUERY>
insurance_and_eClaims
SELECT customer_details FROM customers UNION SELECT staff_details FROM staff
Find the names of all the customers and staff members.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the names of the customers and staff members?</question> [SQL]:
<SQL_QUERY>SELECT customer_details FROM customers UNION SELECT staff_details FROM staff</SQL_QUERY>
insurance_and_eClaims
SELECT customer_details FROM customers UNION SELECT staff_details FROM staff
What are the names of the customers and staff members?
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Find the number of records of each policy type and its type code.</question> [SQL]:
<SQL_QUERY>SELECT policy_type_code , count(*) FROM policies GROUP BY policy_type_code</SQL_QUERY>
insurance_and_eClaims
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) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>For each policy type, return its type code and its count in the record.</question> [SQL]:
<SQL_QUERY>SELECT policy_type_code , count(*) FROM policies GROUP BY policy_type_code</SQL_QUERY>
insurance_and_eClaims
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) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Find the name of the customer that has been involved in the most policies.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
Find the name of the customer that has been involved in the most policies.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Which customer have the most policies? Give me the customer details.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
Which customer have the most policies? Give me the customer details.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What is the description of the claim status "Open"?</question> [SQL]:
<SQL_QUERY>SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name = "Open"</SQL_QUERY>
insurance_and_eClaims
SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name = "Open"
What is the description of the claim status "Open"?
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Find the description of the claim status "Open".</question> [SQL]:
<SQL_QUERY>SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name = "Open"</SQL_QUERY>
insurance_and_eClaims
SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name = "Open"
Find the description of the claim status "Open".
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>How many distinct claim outcome codes are there?</question> [SQL]:
<SQL_QUERY>SELECT count(DISTINCT claim_outcome_code) FROM claims_processing</SQL_QUERY>
insurance_and_eClaims
SELECT count(DISTINCT claim_outcome_code) FROM claims_processing
How many distinct claim outcome codes are there?
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Count the number of distinct claim outcome codes.</question> [SQL]:
<SQL_QUERY>SELECT count(DISTINCT claim_outcome_code) FROM claims_processing</SQL_QUERY>
insurance_and_eClaims
SELECT count(DISTINCT claim_outcome_code) FROM claims_processing
Count the number of distinct claim outcome codes.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Which customer is associated with the latest policy?</question> [SQL]:
<SQL_QUERY>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)</SQL_QUERY>
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)
Which customer is associated with the latest policy?
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);</schema>" <primary_keys>[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</primary_keys>" <foreign_keys>[Foreign Keys]: policies : customer_id = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Find the customer who started a policy most recently.</question> [SQL]:
<SQL_QUERY>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)</SQL_QUERY>
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)
Find the customer who started a policy most recently.
[Schema (values) (types)]: | insurance_and_eClaims | Customers : customer_id (text) , customer_details (number) | Staff : staff_id (text) , staff_details (number) | Policies : policy_id (text) , customer_id (number) , policy_type_code (text) , start_date (number) , end_date (text) | Claim_Headers : claim_header_id (text) , claim_status_code (number) , claim_type_code (text) , policy_id (number) , date_of_claim (text) , date_of_settlement (number) , amount_claimed (number) , amount_piad (text) | Claims_Documents : claim_id (text) , document_type_code (number) , created_by_staff_id (text) , created_date (number) | Claims_Processing_Stages : claim_stage_id (text) , next_claim_stage_id (number) , claim_status_name (text) , claim_status_description (number) | Claims_Processing : claim_processing_id (text) , claim_id (number) , claim_outcome_code (text) , claim_stage_id (number) , staff_id (text);
[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 = customers : customer_id | claim_headers : policy_id = policies : policy_id | claims_documents : created_by_staff_id = staff : staff_id | claims_documents : claim_id = claim_headers : claim_header_id | claims_processing : staff_id = staff : staff_id | claims_processing : claim_id = claim_headers : claim_header_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the number of accounts.</question> [SQL]:
<SQL_QUERY>SELECT count(*) FROM Accounts</SQL_QUERY>
customers_and_invoices
SELECT count(*) FROM Accounts
Show the number of accounts.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>How many accounts are there?</question> [SQL]:
<SQL_QUERY>SELECT count(*) FROM Accounts</SQL_QUERY>
customers_and_invoices
SELECT count(*) FROM Accounts
How many accounts are there?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>How many customers have opened an account?</question> [SQL]:
<SQL_QUERY>SELECT count(DISTINCT customer_id) FROM Accounts</SQL_QUERY>
customers_and_invoices
SELECT count(DISTINCT customer_id) FROM Accounts
How many customers have opened an account?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Count the number of customers who have an account.</question> [SQL]:
<SQL_QUERY>SELECT count(DISTINCT customer_id) FROM Accounts</SQL_QUERY>
customers_and_invoices
SELECT count(DISTINCT customer_id) FROM Accounts
Count the number of customers who have an account.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the id, the date of account opened, the account name, and other account detail for all accounts.</question> [SQL]:
<SQL_QUERY>SELECT account_id , date_account_opened , account_name , other_account_details FROM Accounts</SQL_QUERY>
customers_and_invoices
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) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the ids, date opened, name, and other details for all accounts?</question> [SQL]:
<SQL_QUERY>SELECT account_id , date_account_opened , account_name , other_account_details FROM Accounts</SQL_QUERY>
customers_and_invoices
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) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'.</question> [SQL]:
<SQL_QUERY>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'</SQL_QUERY>
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'
Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the ids, names, dates of opening, and other details for accounts corresponding to the customer with the first name "Meaghan"?</question> [SQL]:
<SQL_QUERY>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'</SQL_QUERY>
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'
What are the ids, names, dates of opening, and other details for accounts corresponding to the customer with the first name "Meaghan"?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the account name and other account detail for all accounts by the customer with first name Meaghan and last name Keeling.</question> [SQL]:
<SQL_QUERY>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"</SQL_QUERY>
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"
Show the account name and other account detail for all accounts by the customer with first name Meaghan and last name Keeling.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the names and other details for accounts corresponding to the customer named Meaghan Keeling?</question> [SQL]:
<SQL_QUERY>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"</SQL_QUERY>
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"
What are the names and other details for accounts corresponding to the customer named Meaghan Keeling?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the first name and last name for the customer with account name 900.</question> [SQL]:
<SQL_QUERY>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"</SQL_QUERY>
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"
Show the first name and last name for the customer with account name 900.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the full names of customers with the account name 900?</question> [SQL]:
<SQL_QUERY>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"</SQL_QUERY>
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"
What are the full names of customers with the account name 900?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>How many customers don't have an account?</question> [SQL]:
<SQL_QUERY>SELECT count(*) FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts)</SQL_QUERY>
customers_and_invoices
SELECT count(*) FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts)
How many customers don't have an account?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Count the number of customers who do not have an account.</question> [SQL]:
<SQL_QUERY>SELECT count(*) FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts)</SQL_QUERY>
customers_and_invoices
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) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the unique first names, last names, and phone numbers for all customers with any account.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
Show the unique first names, last names, and phone numbers for all customers with any account.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the distinct first names, last names, and phone numbers for customers with accounts?</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
What are the distinct first names, last names, and phone numbers for customers with accounts?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show customer ids who don't have an account.</question> [SQL]:
<SQL_QUERY>SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts</SQL_QUERY>
customers_and_invoices
SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts
Show customer ids who don't have an account.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the customer ids for customers who do not have an account?</question> [SQL]:
<SQL_QUERY>SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts</SQL_QUERY>
customers_and_invoices
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) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>How many accounts does each customer have? List the number and customer id.</question> [SQL]:
<SQL_QUERY>SELECT count(*) , customer_id FROM Accounts GROUP BY customer_id</SQL_QUERY>
customers_and_invoices
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) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Count the number of accounts corresponding to each customer id.</question> [SQL]:
<SQL_QUERY>SELECT count(*) , customer_id FROM Accounts GROUP BY customer_id</SQL_QUERY>
customers_and_invoices
SELECT count(*) , customer_id FROM Accounts GROUP BY customer_id
Count the number of accounts corresponding to each customer id.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What is the customer id, first and last name with most number of accounts.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
What is the customer id, first and last name with most number of accounts.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Return the id and full name of the customer with the most accounts.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
Return the id and full name of the customer with the most accounts.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show id, first name and last name for all customers and the number of accounts.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
Show id, first name and last name for all customers and the number of accounts.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the the full names and ids for all customers, and how many accounts does each have?</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
What are the the full names and ids for all customers, and how many accounts does each have?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show first name and id for all customers with at least 2 accounts.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
Show first name and id for all customers with at least 2 accounts.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the first names and ids for customers who have two or more accounts?</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
What are the first names and ids for customers who have two or more accounts?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the number of customers.</question> [SQL]:
<SQL_QUERY>SELECT count(*) FROM Customers</SQL_QUERY>
customers_and_invoices
SELECT count(*) FROM Customers
Show the number of customers.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Count the number of customers.</question> [SQL]:
<SQL_QUERY>SELECT count(*) FROM Customers</SQL_QUERY>
customers_and_invoices
SELECT count(*) FROM Customers
Count the number of customers.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the number of customers for each gender.</question> [SQL]:
<SQL_QUERY>SELECT gender , count(*) FROM Customers GROUP BY gender</SQL_QUERY>
customers_and_invoices
SELECT gender , count(*) FROM Customers GROUP BY gender
Show the number of customers for each gender.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>How many customers are there of each gender?</question> [SQL]:
<SQL_QUERY>SELECT gender , count(*) FROM Customers GROUP BY gender</SQL_QUERY>
customers_and_invoices
SELECT gender , count(*) FROM Customers GROUP BY gender
How many customers are there of each gender?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>How many transactions do we have?</question> [SQL]:
<SQL_QUERY>SELECT count(*) FROM Financial_transactions</SQL_QUERY>
customers_and_invoices
SELECT count(*) FROM Financial_transactions
How many transactions do we have?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Count the number of transactions.</question> [SQL]:
<SQL_QUERY>SELECT count(*) FROM Financial_transactions</SQL_QUERY>
customers_and_invoices
SELECT count(*) FROM Financial_transactions
Count the number of transactions.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>How many transaction does each account have? Show the number and account id.</question> [SQL]:
<SQL_QUERY>SELECT count(*) , account_id FROM Financial_transactions</SQL_QUERY>
customers_and_invoices
SELECT count(*) , account_id FROM Financial_transactions
How many transaction does each account have? Show the number and account id.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Count the number of financial transactions that correspond to each account id.</question> [SQL]:
<SQL_QUERY>SELECT count(*) , account_id FROM Financial_transactions</SQL_QUERY>
customers_and_invoices
SELECT count(*) , account_id FROM Financial_transactions
Count the number of financial transactions that correspond to each account id.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>How many transaction does account with name 337 have?</question> [SQL]:
<SQL_QUERY>SELECT count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = "337"</SQL_QUERY>
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"
How many transaction does account with name 337 have?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Count the number of financial transactions that the account with the name 337 has.</question> [SQL]:
<SQL_QUERY>SELECT count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = "337"</SQL_QUERY>
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"
Count the number of financial transactions that the account with the name 337 has.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What is the average, minimum, maximum, and total transaction amount?</question> [SQL]:
<SQL_QUERY>SELECT avg(transaction_amount) , min(transaction_amount) , max(transaction_amount) , sum(transaction_amount) FROM Financial_transactions</SQL_QUERY>
customers_and_invoices
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) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Return the average, minimum, maximum, and total transaction amounts.</question> [SQL]:
<SQL_QUERY>SELECT avg(transaction_amount) , min(transaction_amount) , max(transaction_amount) , sum(transaction_amount) FROM Financial_transactions</SQL_QUERY>
customers_and_invoices
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) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show ids for all transactions whose amounts are greater than the average.</question> [SQL]:
<SQL_QUERY>SELECT transaction_id FROM Financial_transactions WHERE transaction_amount > (SELECT avg(transaction_amount) FROM Financial_transactions)</SQL_QUERY>
customers_and_invoices
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) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the ids for transactions that have an amount greater than the average amount of a transaction?</question> [SQL]:
<SQL_QUERY>SELECT transaction_id FROM Financial_transactions WHERE transaction_amount > (SELECT avg(transaction_amount) FROM Financial_transactions)</SQL_QUERY>
customers_and_invoices
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) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the transaction types and the total amount of transactions.</question> [SQL]:
<SQL_QUERY>SELECT transaction_type , sum(transaction_amount) FROM Financial_transactions GROUP BY transaction_type</SQL_QUERY>
customers_and_invoices
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) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are total transaction amounts for each transaction type?</question> [SQL]:
<SQL_QUERY>SELECT transaction_type , sum(transaction_amount) FROM Financial_transactions GROUP BY transaction_type</SQL_QUERY>
customers_and_invoices
SELECT transaction_type , sum(transaction_amount) FROM Financial_transactions GROUP BY transaction_type
What are total transaction amounts for each transaction type?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the account name, id and the number of transactions for each account.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
Show the account name, id and the number of transactions for each account.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Return the names and ids of each account, as well as the number of transactions.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
Return the names and ids of each account, as well as the number of transactions.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the account id with most number of transactions.</question> [SQL]:
<SQL_QUERY>SELECT account_id FROM Financial_transactions GROUP BY account_id ORDER BY count(*) DESC LIMIT 1</SQL_QUERY>
customers_and_invoices
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) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What is the id of the account with the most transactions?</question> [SQL]:
<SQL_QUERY>SELECT account_id FROM Financial_transactions GROUP BY account_id ORDER BY count(*) DESC LIMIT 1</SQL_QUERY>
customers_and_invoices
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) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the account id and name with at least 4 transactions.</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
Show the account id and name with at least 4 transactions.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the ids and names of accounts with 4 or more transactions?</question> [SQL]:
<SQL_QUERY>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</SQL_QUERY>
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
What are the ids and names of accounts with 4 or more transactions?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show all product sizes.</question> [SQL]:
<SQL_QUERY>SELECT DISTINCT product_size FROM Products</SQL_QUERY>
customers_and_invoices
SELECT DISTINCT product_size FROM Products
Show all product sizes.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the different product sizes?</question> [SQL]:
<SQL_QUERY>SELECT DISTINCT product_size FROM Products</SQL_QUERY>
customers_and_invoices
SELECT DISTINCT product_size FROM Products
What are the different product sizes?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show all product colors.</question> [SQL]:
<SQL_QUERY>SELECT DISTINCT product_color FROM Products</SQL_QUERY>
customers_and_invoices
SELECT DISTINCT product_color FROM Products
Show all product colors.
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>What are the different product colors?</question> [SQL]:
<SQL_QUERY>SELECT DISTINCT product_color FROM Products</SQL_QUERY>
customers_and_invoices
SELECT DISTINCT product_color FROM Products
What are the different product colors?
[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id
This is a task converting text into SQL statements. We will first give the dataset schema and column types, primary keys and foreign keys and then ask a question in text. You are asked to generate SQL statement in SQLite. <schema>[Schema (values) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);</schema>" <primary_keys>[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id</primary_keys>" <foreign_keys>[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id</foreign_keys>" Answer the following question with a SQL Statement:<question>Show the invoice number and the number of transactions for each invoice.</question> [SQL]:
<SQL_QUERY>SELECT invoice_number , count(*) FROM Financial_transactions GROUP BY invoice_number</SQL_QUERY>
customers_and_invoices
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) (types)]: | customers_and_invoices | Customers : customer_id (text) , customer_first_name (number) , 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 (text) , customer_id (number) , date_order_placed (text) , order_details (text) | Invoices : invoice_number (text) , order_id (number) , invoice_date (text) | Accounts : account_id (text) , customer_id (number) , date_account_opened (text) , account_name (text) , other_account_details (text) | Product_Categories : production_type_code (text) , product_type_description (number) , vat_rating (text) | Products : product_id (text) , parent_product_id (number) , production_type_code (text) , unit_price (text) , product_name (text) , product_color (text) , product_size (text) | Financial_Transactions : transaction_id (text) , account_id (number) , invoice_number (text) , transaction_type (text) , transaction_date (text) , transaction_amount (text) , transaction_comment (text) , other_transaction_details (text) | Order_Items : order_item_id (text) , order_id (number) , product_id (text) , product_quantity (text) , other_order_item_details (text) | Invoice_Line_Items : order_item_id (text) , invoice_number (number) , product_id (text) , product_title (text) , product_quantity (text) , product_price (text) , derived_product_cost (text) , derived_vat_payable (text) , derived_total_cost (text);
[Primary Keys]: customers : customer_id, orders : order_id, invoices : invoice_number, accounts : account_id, product_categories : production_type_code, products : product_id, financial_transactions : order_item_id
[Foreign Keys]: orders : customer_id = customers : customer_id | invoices : order_id = orders : order_id | accounts : customer_id = customers : customer_id | products : production_type_code = product_categories : production_type_code | financial_transactions : account_id = accounts : account_id | financial_transactions : invoice_number = invoices : invoice_number | order_items : order_id = orders : order_id | order_items : product_id = products : product_id | invoice_line_items : product_id = products : product_id | invoice_line_items : invoice_number = invoices : invoice_number | invoice_line_items : order_item_id = order_items : order_item_id