db_id
stringclasses
140 values
schema
listlengths
0
26
question
stringlengths
16
224
query
stringlengths
18
577
query_toks
listlengths
4
90
query_toks_no_value
listlengths
4
125
question_toks
listlengths
4
44
debate
[ "CREATE TABLE \"people\" (\n\"People_ID\" int,\n\"District\" text,\n\"Name\" text,\n\"Party\" text,\n\"Age\" int,\nPRIMARY KEY (\"People_ID\")\n);", "CREATE TABLE \"debate\" (\n\"Debate_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Num_of_Audience\" int,\nPRIMARY KEY (\"Debate_ID\")\n);", "CREATE TABLE \"debate_people\" (\n\"Debate_ID\" int,\n\"Affirmative\" int,\n\"Negative\" int,\n\"If_Affirmative_Win\" bool,\nPRIMARY KEY (\"Debate_ID\",\"Affirmative\",\"Negative\"),\nFOREIGN KEY (\"Debate_ID\") REFERENCES `debate`(\"Debate_ID\"),\nFOREIGN KEY (\"Affirmative\") REFERENCES `people`(\"People_ID\"),\nFOREIGN KEY (\"Negative\") REFERENCES `people`(\"People_ID\")\n);" ]
Show the distinct venues of debates
SELECT DISTINCT Venue FROM debate
[ "SELECT", "DISTINCT", "Venue", "FROM", "debate" ]
[ "select", "distinct", "venue", "from", "debate" ]
[ "Show", "the", "distinct", "venues", "of", "debates" ]
debate
[ "CREATE TABLE \"people\" (\n\"People_ID\" int,\n\"District\" text,\n\"Name\" text,\n\"Party\" text,\n\"Age\" int,\nPRIMARY KEY (\"People_ID\")\n);", "CREATE TABLE \"debate\" (\n\"Debate_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Num_of_Audience\" int,\nPRIMARY KEY (\"Debate_ID\")\n);", "CREATE TABLE \"debate_people\" (\n\"Debate_ID\" int,\n\"Affirmative\" int,\n\"Negative\" int,\n\"If_Affirmative_Win\" bool,\nPRIMARY KEY (\"Debate_ID\",\"Affirmative\",\"Negative\"),\nFOREIGN KEY (\"Debate_ID\") REFERENCES `debate`(\"Debate_ID\"),\nFOREIGN KEY (\"Affirmative\") REFERENCES `people`(\"People_ID\"),\nFOREIGN KEY (\"Negative\") REFERENCES `people`(\"People_ID\")\n);" ]
Show the names of people, and dates and venues of debates they are on the affirmative side.
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
[ "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" ]
[ "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", "." ]
debate
[ "CREATE TABLE \"people\" (\n\"People_ID\" int,\n\"District\" text,\n\"Name\" text,\n\"Party\" text,\n\"Age\" int,\nPRIMARY KEY (\"People_ID\")\n);", "CREATE TABLE \"debate\" (\n\"Debate_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Num_of_Audience\" int,\nPRIMARY KEY (\"Debate_ID\")\n);", "CREATE TABLE \"debate_people\" (\n\"Debate_ID\" int,\n\"Affirmative\" int,\n\"Negative\" int,\n\"If_Affirmative_Win\" bool,\nPRIMARY KEY (\"Debate_ID\",\"Affirmative\",\"Negative\"),\nFOREIGN KEY (\"Debate_ID\") REFERENCES `debate`(\"Debate_ID\"),\nFOREIGN KEY (\"Affirmative\") REFERENCES `people`(\"People_ID\"),\nFOREIGN KEY (\"Negative\") REFERENCES `people`(\"People_ID\")\n);" ]
Show the names of people, and dates and venues of debates they are on the negative side, ordered in ascending alphabetical order of name.
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
[ "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" ]
[ "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", "." ]
debate
[ "CREATE TABLE \"people\" (\n\"People_ID\" int,\n\"District\" text,\n\"Name\" text,\n\"Party\" text,\n\"Age\" int,\nPRIMARY KEY (\"People_ID\")\n);", "CREATE TABLE \"debate\" (\n\"Debate_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Num_of_Audience\" int,\nPRIMARY KEY (\"Debate_ID\")\n);", "CREATE TABLE \"debate_people\" (\n\"Debate_ID\" int,\n\"Affirmative\" int,\n\"Negative\" int,\n\"If_Affirmative_Win\" bool,\nPRIMARY KEY (\"Debate_ID\",\"Affirmative\",\"Negative\"),\nFOREIGN KEY (\"Debate_ID\") REFERENCES `debate`(\"Debate_ID\"),\nFOREIGN KEY (\"Affirmative\") REFERENCES `people`(\"People_ID\"),\nFOREIGN KEY (\"Negative\") REFERENCES `people`(\"People_ID\")\n);" ]
Show the names of people that are on affirmative side of debates with number of audience bigger than 200.
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
[ "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" ]
[ "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", ">", "value" ]
[ "Show", "the", "names", "of", "people", "that", "are", "on", "affirmative", "side", "of", "debates", "with", "number", "of", "audience", "bigger", "than", "200", "." ]
debate
[ "CREATE TABLE \"people\" (\n\"People_ID\" int,\n\"District\" text,\n\"Name\" text,\n\"Party\" text,\n\"Age\" int,\nPRIMARY KEY (\"People_ID\")\n);", "CREATE TABLE \"debate\" (\n\"Debate_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Num_of_Audience\" int,\nPRIMARY KEY (\"Debate_ID\")\n);", "CREATE TABLE \"debate_people\" (\n\"Debate_ID\" int,\n\"Affirmative\" int,\n\"Negative\" int,\n\"If_Affirmative_Win\" bool,\nPRIMARY KEY (\"Debate_ID\",\"Affirmative\",\"Negative\"),\nFOREIGN KEY (\"Debate_ID\") REFERENCES `debate`(\"Debate_ID\"),\nFOREIGN KEY (\"Affirmative\") REFERENCES `people`(\"People_ID\"),\nFOREIGN KEY (\"Negative\") REFERENCES `people`(\"People_ID\")\n);" ]
Show the names of people and the number of times they have been on the affirmative side of debates.
SELECT T2.Name , COUNT(*) FROM debate_people AS T1 JOIN people AS T2 ON T1.Affirmative = T2.People_ID GROUP BY T2.Name
[ "SELECT", "T2.Name", ",", "COUNT", "(", "*", ")", "FROM", "debate_people", "AS", "T1", "JOIN", "people", "AS", "T2", "ON", "T1.Affirmative", "=", "T2.People_ID", "GROUP", "BY", "T2.Name" ]
[ "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", "." ]
debate
[ "CREATE TABLE \"people\" (\n\"People_ID\" int,\n\"District\" text,\n\"Name\" text,\n\"Party\" text,\n\"Age\" int,\nPRIMARY KEY (\"People_ID\")\n);", "CREATE TABLE \"debate\" (\n\"Debate_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Num_of_Audience\" int,\nPRIMARY KEY (\"Debate_ID\")\n);", "CREATE TABLE \"debate_people\" (\n\"Debate_ID\" int,\n\"Affirmative\" int,\n\"Negative\" int,\n\"If_Affirmative_Win\" bool,\nPRIMARY KEY (\"Debate_ID\",\"Affirmative\",\"Negative\"),\nFOREIGN KEY (\"Debate_ID\") REFERENCES `debate`(\"Debate_ID\"),\nFOREIGN KEY (\"Affirmative\") REFERENCES `people`(\"People_ID\"),\nFOREIGN KEY (\"Negative\") REFERENCES `people`(\"People_ID\")\n);" ]
Show the names of people who have been on the negative side of debates at least twice.
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
[ "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" ]
[ "select", "t2", ".", "name", "from", "debate_people", "as", "t1", "join", "people", "as", "t2", "on", "t1", ".", "negative", "=", "t2", ".", "people_id", "group", "by", "t2", ".", "name", "having", "count", "(", "*", ")", ">", "=", "value" ]
[ "Show", "the", "names", "of", "people", "who", "have", "been", "on", "the", "negative", "side", "of", "debates", "at", "least", "twice", "." ]
debate
[ "CREATE TABLE \"people\" (\n\"People_ID\" int,\n\"District\" text,\n\"Name\" text,\n\"Party\" text,\n\"Age\" int,\nPRIMARY KEY (\"People_ID\")\n);", "CREATE TABLE \"debate\" (\n\"Debate_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Num_of_Audience\" int,\nPRIMARY KEY (\"Debate_ID\")\n);", "CREATE TABLE \"debate_people\" (\n\"Debate_ID\" int,\n\"Affirmative\" int,\n\"Negative\" int,\n\"If_Affirmative_Win\" bool,\nPRIMARY KEY (\"Debate_ID\",\"Affirmative\",\"Negative\"),\nFOREIGN KEY (\"Debate_ID\") REFERENCES `debate`(\"Debate_ID\"),\nFOREIGN KEY (\"Affirmative\") REFERENCES `people`(\"People_ID\"),\nFOREIGN KEY (\"Negative\") REFERENCES `people`(\"People_ID\")\n);" ]
List the names of people that have not been on the affirmative side of debates.
SELECT Name FROM people WHERE People_id NOT IN (SELECT Affirmative FROM debate_people)
[ "SELECT", "Name", "FROM", "people", "WHERE", "People_id", "NOT", "IN", "(", "SELECT", "Affirmative", "FROM", "debate_people", ")" ]
[ "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", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
List the names of all the customers in alphabetical order.
SELECT customer_details FROM customers ORDER BY customer_details
[ "SELECT", "customer_details", "FROM", "customers", "ORDER", "BY", "customer_details" ]
[ "select", "customer_details", "from", "customers", "order", "by", "customer_details" ]
[ "List", "the", "names", "of", "all", "the", "customers", "in", "alphabetical", "order", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Sort the customer names in alphabetical order.
SELECT customer_details FROM customers ORDER BY customer_details
[ "SELECT", "customer_details", "FROM", "customers", "ORDER", "BY", "customer_details" ]
[ "select", "customer_details", "from", "customers", "order", "by", "customer_details" ]
[ "Sort", "the", "customer", "names", "in", "alphabetical", "order", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Find all the policy type codes associated with the customer "Dayana Robel"
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"
[ "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", "''" ]
[ "select", "policy_type_code", "from", "policies", "as", "t1", "join", "customers", "as", "t2", "on", "t1", ".", "customer_id", "=", "t2", ".", "customer_id", "where", "t2", ".", "customer_details", "=", "value" ]
[ "Find", "all", "the", "policy", "type", "codes", "associated", "with", "the", "customer", "``", "Dayana", "Robel", "''" ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
What are the type codes of the policies used by the customer "Dayana Robel"?
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"
[ "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", "''" ]
[ "select", "policy_type_code", "from", "policies", "as", "t1", "join", "customers", "as", "t2", "on", "t1", ".", "customer_id", "=", "t2", ".", "customer_id", "where", "t2", ".", "customer_details", "=", "value" ]
[ "What", "are", "the", "type", "codes", "of", "the", "policies", "used", "by", "the", "customer", "``", "Dayana", "Robel", "''", "?" ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Which type of policy is most frequently used? Give me the policy type code.
SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
[ "SELECT", "policy_type_code", "FROM", "policies", "GROUP", "BY", "policy_type_code", "ORDER", "BY", "count", "(", "*", ")", "DESC", "LIMIT", "1" ]
[ "select", "policy_type_code", "from", "policies", "group", "by", "policy_type_code", "order", "by", "count", "(", "*", ")", "desc", "limit", "value" ]
[ "Which", "type", "of", "policy", "is", "most", "frequently", "used", "?", "Give", "me", "the", "policy", "type", "code", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Find the type code of the most frequently used policy.
SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
[ "SELECT", "policy_type_code", "FROM", "policies", "GROUP", "BY", "policy_type_code", "ORDER", "BY", "count", "(", "*", ")", "DESC", "LIMIT", "1" ]
[ "select", "policy_type_code", "from", "policies", "group", "by", "policy_type_code", "order", "by", "count", "(", "*", ")", "desc", "limit", "value" ]
[ "Find", "the", "type", "code", "of", "the", "most", "frequently", "used", "policy", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Find all the policy types that are used by more than 2 customers.
SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*) > 2
[ "SELECT", "policy_type_code", "FROM", "policies", "GROUP", "BY", "policy_type_code", "HAVING", "count", "(", "*", ")", ">", "2" ]
[ "select", "policy_type_code", "from", "policies", "group", "by", "policy_type_code", "having", "count", "(", "*", ")", ">", "value" ]
[ "Find", "all", "the", "policy", "types", "that", "are", "used", "by", "more", "than", "2", "customers", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Which types of policy are chosen by more than 2 customers? Give me the policy type codes.
SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*) > 2
[ "SELECT", "policy_type_code", "FROM", "policies", "GROUP", "BY", "policy_type_code", "HAVING", "count", "(", "*", ")", ">", "2" ]
[ "select", "policy_type_code", "from", "policies", "group", "by", "policy_type_code", "having", "count", "(", "*", ")", ">", "value" ]
[ "Which", "types", "of", "policy", "are", "chosen", "by", "more", "than", "2", "customers", "?", "Give", "me", "the", "policy", "type", "codes", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Find the total and average amount paid in claim headers.
SELECT sum(amount_piad) , avg(amount_piad) FROM claim_headers
[ "SELECT", "sum", "(", "amount_piad", ")", ",", "avg", "(", "amount_piad", ")", "FROM", "claim_headers" ]
[ "select", "sum", "(", "amount_piad", ")", ",", "avg", "(", "amount_piad", ")", "from", "claim_headers" ]
[ "Find", "the", "total", "and", "average", "amount", "paid", "in", "claim", "headers", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
What are the total amount and average amount paid in claim headers?
SELECT sum(amount_piad) , avg(amount_piad) FROM claim_headers
[ "SELECT", "sum", "(", "amount_piad", ")", ",", "avg", "(", "amount_piad", ")", "FROM", "claim_headers" ]
[ "select", "sum", "(", "amount_piad", ")", ",", "avg", "(", "amount_piad", ")", "from", "claim_headers" ]
[ "What", "are", "the", "total", "amount", "and", "average", "amount", "paid", "in", "claim", "headers", "?" ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Find the total amount claimed in the most recently created document.
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)
[ "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", ")" ]
[ "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", "value", ")" ]
[ "Find", "the", "total", "amount", "claimed", "in", "the", "most", "recently", "created", "document", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
How much amount in total were claimed in the most recently created document?
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)
[ "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", ")" ]
[ "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", "value", ")" ]
[ "How", "much", "amount", "in", "total", "were", "claimed", "in", "the", "most", "recently", "created", "document", "?" ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
What is the name of the customer who has made the largest amount of claim in a single claim?
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)
[ "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", ")" ]
[ "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", "?" ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Which customer made the largest amount of claim in a single claim? Return the customer details.
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)
[ "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", ")" ]
[ "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", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
What is the name of the customer who has made the minimum amount of payment in one claim?
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)
[ "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", ")" ]
[ "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", "?" ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Which customer made the smallest amount of claim in one claim? Return the customer details.
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)
[ "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", ")" ]
[ "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", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Find the names of customers who have no policies associated.
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
[ "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" ]
[ "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", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
What are the names of customers who do not have any policies?
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
[ "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" ]
[ "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", "?" ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
How many claim processing stages are there in total?
SELECT count(*) FROM claims_processing_stages
[ "SELECT", "count", "(", "*", ")", "FROM", "claims_processing_stages" ]
[ "select", "count", "(", "*", ")", "from", "claims_processing_stages" ]
[ "How", "many", "claim", "processing", "stages", "are", "there", "in", "total", "?" ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Find the number of distinct stages in claim processing.
SELECT count(*) FROM claims_processing_stages
[ "SELECT", "count", "(", "*", ")", "FROM", "claims_processing_stages" ]
[ "select", "count", "(", "*", ")", "from", "claims_processing_stages" ]
[ "Find", "the", "number", "of", "distinct", "stages", "in", "claim", "processing", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
What is the name of the claim processing stage that most of the claims are on?
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
[ "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" ]
[ "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", "value" ]
[ "What", "is", "the", "name", "of", "the", "claim", "processing", "stage", "that", "most", "of", "the", "claims", "are", "on", "?" ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Which claim processing stage has the most claims? Show the claim status name.
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
[ "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" ]
[ "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", "value" ]
[ "Which", "claim", "processing", "stage", "has", "the", "most", "claims", "?", "Show", "the", "claim", "status", "name", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Find the names of customers whose name contains "Diana".
SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%"
[ "SELECT", "customer_details", "FROM", "customers", "WHERE", "customer_details", "LIKE", "``", "%", "Diana", "%", "''" ]
[ "select", "customer_details", "from", "customers", "where", "customer_details", "like", "value" ]
[ "Find", "the", "names", "of", "customers", "whose", "name", "contains", "``", "Diana", "''", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Which customers have the substring "Diana" in their names? Return the customer details.
SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%"
[ "SELECT", "customer_details", "FROM", "customers", "WHERE", "customer_details", "LIKE", "``", "%", "Diana", "%", "''" ]
[ "select", "customer_details", "from", "customers", "where", "customer_details", "like", "value" ]
[ "Which", "customers", "have", "the", "substring", "``", "Diana", "''", "in", "their", "names", "?", "Return", "the", "customer", "details", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Find the names of the customers who have an deputy policy.
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "Find", "the", "names", "of", "the", "customers", "who", "have", "an", "deputy", "policy", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Which customers have an insurance policy with the type code "Deputy"? Give me the customer details.
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "Which", "customers", "have", "an", "insurance", "policy", "with", "the", "type", "code", "``", "Deputy", "''", "?", "Give", "me", "the", "customer", "details", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Find the names of customers who either have an deputy policy or uniformed policy.
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"
[ "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", "''" ]
[ "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", "=", "value", "or", "t1", ".", "policy_type_code", "=", "value" ]
[ "Find", "the", "names", "of", "customers", "who", "either", "have", "an", "deputy", "policy", "or", "uniformed", "policy", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Which customers have an insurance policy with the type code "Deputy" or "Uniform"? Return the customer details.
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"
[ "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", "''" ]
[ "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", "=", "value", "or", "t1", ".", "policy_type_code", "=", "value" ]
[ "Which", "customers", "have", "an", "insurance", "policy", "with", "the", "type", "code", "``", "Deputy", "''", "or", "``", "Uniform", "''", "?", "Return", "the", "customer", "details", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Find the names of all the customers and staff members.
SELECT customer_details FROM customers UNION SELECT staff_details FROM staff
[ "SELECT", "customer_details", "FROM", "customers", "UNION", "SELECT", "staff_details", "FROM", "staff" ]
[ "select", "customer_details", "from", "customers", "union", "select", "staff_details", "from", "staff" ]
[ "Find", "the", "names", "of", "all", "the", "customers", "and", "staff", "members", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
What are the names of the customers and staff members?
SELECT customer_details FROM customers UNION SELECT staff_details FROM staff
[ "SELECT", "customer_details", "FROM", "customers", "UNION", "SELECT", "staff_details", "FROM", "staff" ]
[ "select", "customer_details", "from", "customers", "union", "select", "staff_details", "from", "staff" ]
[ "What", "are", "the", "names", "of", "the", "customers", "and", "staff", "members", "?" ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Find the number of records of each policy type and its type code.
SELECT policy_type_code , count(*) FROM policies GROUP BY policy_type_code
[ "SELECT", "policy_type_code", ",", "count", "(", "*", ")", "FROM", "policies", "GROUP", "BY", "policy_type_code" ]
[ "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", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
For each policy type, return its type code and its count in the record.
SELECT policy_type_code , count(*) FROM policies GROUP BY policy_type_code
[ "SELECT", "policy_type_code", ",", "count", "(", "*", ")", "FROM", "policies", "GROUP", "BY", "policy_type_code" ]
[ "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", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Find the name of the customer that has been involved in the most policies.
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
[ "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" ]
[ "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", "value" ]
[ "Find", "the", "name", "of", "the", "customer", "that", "has", "been", "involved", "in", "the", "most", "policies", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Which customer have the most policies? Give me the customer details.
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
[ "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" ]
[ "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", "value" ]
[ "Which", "customer", "have", "the", "most", "policies", "?", "Give", "me", "the", "customer", "details", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
What is the description of the claim status "Open"?
SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name = "Open"
[ "SELECT", "claim_status_description", "FROM", "claims_processing_stages", "WHERE", "claim_status_name", "=", "``", "Open", "''" ]
[ "select", "claim_status_description", "from", "claims_processing_stages", "where", "claim_status_name", "=", "value" ]
[ "What", "is", "the", "description", "of", "the", "claim", "status", "``", "Open", "''", "?" ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Find the description of the claim status "Open".
SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name = "Open"
[ "SELECT", "claim_status_description", "FROM", "claims_processing_stages", "WHERE", "claim_status_name", "=", "``", "Open", "''" ]
[ "select", "claim_status_description", "from", "claims_processing_stages", "where", "claim_status_name", "=", "value" ]
[ "Find", "the", "description", "of", "the", "claim", "status", "``", "Open", "''", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
How many distinct claim outcome codes are there?
SELECT count(DISTINCT claim_outcome_code) FROM claims_processing
[ "SELECT", "count", "(", "DISTINCT", "claim_outcome_code", ")", "FROM", "claims_processing" ]
[ "select", "count", "(", "distinct", "claim_outcome_code", ")", "from", "claims_processing" ]
[ "How", "many", "distinct", "claim", "outcome", "codes", "are", "there", "?" ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Count the number of distinct claim outcome codes.
SELECT count(DISTINCT claim_outcome_code) FROM claims_processing
[ "SELECT", "count", "(", "DISTINCT", "claim_outcome_code", ")", "FROM", "claims_processing" ]
[ "select", "count", "(", "distinct", "claim_outcome_code", ")", "from", "claims_processing" ]
[ "Count", "the", "number", "of", "distinct", "claim", "outcome", "codes", "." ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Which customer is associated with the latest policy?
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)
[ "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", ")" ]
[ "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", "?" ]
insurance_and_eClaims
[ "CREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);", "CREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);", "CREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);", "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);", "CREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);", "CREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);", "CREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);" ]
Find the customer who started a policy most recently.
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)
[ "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", ")" ]
[ "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", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show the number of accounts.
SELECT count(*) FROM Accounts
[ "SELECT", "count", "(", "*", ")", "FROM", "Accounts" ]
[ "select", "count", "(", "*", ")", "from", "accounts" ]
[ "Show", "the", "number", "of", "accounts", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
How many accounts are there?
SELECT count(*) FROM Accounts
[ "SELECT", "count", "(", "*", ")", "FROM", "Accounts" ]
[ "select", "count", "(", "*", ")", "from", "accounts" ]
[ "How", "many", "accounts", "are", "there", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
How many customers have opened an account?
SELECT count(DISTINCT customer_id) FROM Accounts
[ "SELECT", "count", "(", "DISTINCT", "customer_id", ")", "FROM", "Accounts" ]
[ "select", "count", "(", "distinct", "customer_id", ")", "from", "accounts" ]
[ "How", "many", "customers", "have", "opened", "an", "account", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Count the number of customers who have an account.
SELECT count(DISTINCT customer_id) FROM Accounts
[ "SELECT", "count", "(", "DISTINCT", "customer_id", ")", "FROM", "Accounts" ]
[ "select", "count", "(", "distinct", "customer_id", ")", "from", "accounts" ]
[ "Count", "the", "number", "of", "customers", "who", "have", "an", "account", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show the id, the date of account opened, the account name, and other account detail for all accounts.
SELECT account_id , date_account_opened , account_name , other_account_details FROM Accounts
[ "SELECT", "account_id", ",", "date_account_opened", ",", "account_name", ",", "other_account_details", "FROM", "Accounts" ]
[ "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", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What are the ids, date opened, name, and other details for all accounts?
SELECT account_id , date_account_opened , account_name , other_account_details FROM Accounts
[ "SELECT", "account_id", ",", "date_account_opened", ",", "account_name", ",", "other_account_details", "FROM", "Accounts" ]
[ "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", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'.
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'
[ "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", "'" ]
[ "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", "=", "value" ]
[ "Show", "the", "id", ",", "the", "account", "name", ",", "and", "other", "account", "details", "for", "all", "accounts", "by", "the", "customer", "with", "first", "name", "'Meaghan", "'", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What are the ids, names, dates of opening, and other details for accounts corresponding to the customer with the first name "Meaghan"?
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'
[ "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", "'" ]
[ "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", "=", "value" ]
[ "What", "are", "the", "ids", ",", "names", ",", "dates", "of", "opening", ",", "and", "other", "details", "for", "accounts", "corresponding", "to", "the", "customer", "with", "the", "first", "name", "``", "Meaghan", "''", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show the account name and other account detail for all accounts by the customer with first name Meaghan and last name Keeling.
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"
[ "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", "''" ]
[ "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", "=", "value", "and", "t2", ".", "customer_last_name", "=", "value" ]
[ "Show", "the", "account", "name", "and", "other", "account", "detail", "for", "all", "accounts", "by", "the", "customer", "with", "first", "name", "Meaghan", "and", "last", "name", "Keeling", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What are the names and other details for accounts corresponding to the customer named Meaghan Keeling?
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"
[ "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", "''" ]
[ "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", "=", "value", "and", "t2", ".", "customer_last_name", "=", "value" ]
[ "What", "are", "the", "names", "and", "other", "details", "for", "accounts", "corresponding", "to", "the", "customer", "named", "Meaghan", "Keeling", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show the first name and last name for the customer with account name 900.
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "Show", "the", "first", "name", "and", "last", "name", "for", "the", "customer", "with", "account", "name", "900", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What are the full names of customers with the account name 900?
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "What", "are", "the", "full", "names", "of", "customers", "with", "the", "account", "name", "900", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
How many customers don't have an account?
SELECT count(*) FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts)
[ "SELECT", "count", "(", "*", ")", "FROM", "Customers", "WHERE", "customer_id", "NOT", "IN", "(", "SELECT", "customer_id", "FROM", "Accounts", ")" ]
[ "select", "count", "(", "*", ")", "from", "customers", "where", "customer_id", "not", "in", "(", "select", "customer_id", "from", "accounts", ")" ]
[ "How", "many", "customers", "do", "n't", "have", "an", "account", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Count the number of customers who do not have an account.
SELECT count(*) FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts)
[ "SELECT", "count", "(", "*", ")", "FROM", "Customers", "WHERE", "customer_id", "NOT", "IN", "(", "SELECT", "customer_id", "FROM", "Accounts", ")" ]
[ "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", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show the unique first names, last names, and phone numbers for all customers with any account.
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
[ "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" ]
[ "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", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What are the distinct first names, last names, and phone numbers for customers with accounts?
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
[ "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" ]
[ "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", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show customer ids who don't have an account.
SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts
[ "SELECT", "customer_id", "FROM", "Customers", "EXCEPT", "SELECT", "customer_id", "FROM", "Accounts" ]
[ "select", "customer_id", "from", "customers", "except", "select", "customer_id", "from", "accounts" ]
[ "Show", "customer", "ids", "who", "do", "n't", "have", "an", "account", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What are the customer ids for customers who do not have an account?
SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts
[ "SELECT", "customer_id", "FROM", "Customers", "EXCEPT", "SELECT", "customer_id", "FROM", "Accounts" ]
[ "select", "customer_id", "from", "customers", "except", "select", "customer_id", "from", "accounts" ]
[ "What", "are", "the", "customer", "ids", "for", "customers", "who", "do", "not", "have", "an", "account", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
How many accounts does each customer have? List the number and customer id.
SELECT count(*) , customer_id FROM Accounts GROUP BY customer_id
[ "SELECT", "count", "(", "*", ")", ",", "customer_id", "FROM", "Accounts", "GROUP", "BY", "customer_id" ]
[ "select", "count", "(", "*", ")", ",", "customer_id", "from", "accounts", "group", "by", "customer_id" ]
[ "How", "many", "accounts", "does", "each", "customer", "have", "?", "List", "the", "number", "and", "customer", "id", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Count the number of accounts corresponding to each customer id.
SELECT count(*) , customer_id FROM Accounts GROUP BY customer_id
[ "SELECT", "count", "(", "*", ")", ",", "customer_id", "FROM", "Accounts", "GROUP", "BY", "customer_id" ]
[ "select", "count", "(", "*", ")", ",", "customer_id", "from", "accounts", "group", "by", "customer_id" ]
[ "Count", "the", "number", "of", "accounts", "corresponding", "to", "each", "customer", "id", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What is the customer id, first and last name with most number of accounts.
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
[ "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" ]
[ "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", "value" ]
[ "What", "is", "the", "customer", "id", ",", "first", "and", "last", "name", "with", "most", "number", "of", "accounts", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Return the id and full name of the customer with the most accounts.
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
[ "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" ]
[ "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", "value" ]
[ "Return", "the", "id", "and", "full", "name", "of", "the", "customer", "with", "the", "most", "accounts", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show id, first name and last name for all customers and the number of accounts.
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
[ "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" ]
[ "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", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What are the the full names and ids for all customers, and how many accounts does each have?
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
[ "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" ]
[ "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", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show first name and id for all customers with at least 2 accounts.
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
[ "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" ]
[ "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", "(", "*", ")", ">", "=", "value" ]
[ "Show", "first", "name", "and", "id", "for", "all", "customers", "with", "at", "least", "2", "accounts", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What are the first names and ids for customers who have two or more accounts?
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
[ "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" ]
[ "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", "(", "*", ")", ">", "=", "value" ]
[ "What", "are", "the", "first", "names", "and", "ids", "for", "customers", "who", "have", "two", "or", "more", "accounts", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show the number of customers.
SELECT count(*) FROM Customers
[ "SELECT", "count", "(", "*", ")", "FROM", "Customers" ]
[ "select", "count", "(", "*", ")", "from", "customers" ]
[ "Show", "the", "number", "of", "customers", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Count the number of customers.
SELECT count(*) FROM Customers
[ "SELECT", "count", "(", "*", ")", "FROM", "Customers" ]
[ "select", "count", "(", "*", ")", "from", "customers" ]
[ "Count", "the", "number", "of", "customers", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show the number of customers for each gender.
SELECT gender , count(*) FROM Customers GROUP BY gender
[ "SELECT", "gender", ",", "count", "(", "*", ")", "FROM", "Customers", "GROUP", "BY", "gender" ]
[ "select", "gender", ",", "count", "(", "*", ")", "from", "customers", "group", "by", "gender" ]
[ "Show", "the", "number", "of", "customers", "for", "each", "gender", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
How many customers are there of each gender?
SELECT gender , count(*) FROM Customers GROUP BY gender
[ "SELECT", "gender", ",", "count", "(", "*", ")", "FROM", "Customers", "GROUP", "BY", "gender" ]
[ "select", "gender", ",", "count", "(", "*", ")", "from", "customers", "group", "by", "gender" ]
[ "How", "many", "customers", "are", "there", "of", "each", "gender", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
How many transactions do we have?
SELECT count(*) FROM Financial_transactions
[ "SELECT", "count", "(", "*", ")", "FROM", "Financial_transactions" ]
[ "select", "count", "(", "*", ")", "from", "financial_transactions" ]
[ "How", "many", "transactions", "do", "we", "have", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Count the number of transactions.
SELECT count(*) FROM Financial_transactions
[ "SELECT", "count", "(", "*", ")", "FROM", "Financial_transactions" ]
[ "select", "count", "(", "*", ")", "from", "financial_transactions" ]
[ "Count", "the", "number", "of", "transactions", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
How many transaction does each account have? Show the number and account id.
SELECT count(*) , account_id FROM Financial_transactions
[ "SELECT", "count", "(", "*", ")", ",", "account_id", "FROM", "Financial_transactions" ]
[ "select", "count", "(", "*", ")", ",", "account_id", "from", "financial_transactions" ]
[ "How", "many", "transaction", "does", "each", "account", "have", "?", "Show", "the", "number", "and", "account", "id", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Count the number of financial transactions that correspond to each account id.
SELECT count(*) , account_id FROM Financial_transactions
[ "SELECT", "count", "(", "*", ")", ",", "account_id", "FROM", "Financial_transactions" ]
[ "select", "count", "(", "*", ")", ",", "account_id", "from", "financial_transactions" ]
[ "Count", "the", "number", "of", "financial", "transactions", "that", "correspond", "to", "each", "account", "id", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
How many transaction does account with name 337 have?
SELECT count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = "337"
[ "SELECT", "count", "(", "*", ")", "FROM", "Financial_transactions", "AS", "T1", "JOIN", "Accounts", "AS", "T2", "ON", "T1.account_id", "=", "T2.account_id", "WHERE", "T2.account_name", "=", "``", "337", "''" ]
[ "select", "count", "(", "*", ")", "from", "financial_transactions", "as", "t1", "join", "accounts", "as", "t2", "on", "t1", ".", "account_id", "=", "t2", ".", "account_id", "where", "t2", ".", "account_name", "=", "value" ]
[ "How", "many", "transaction", "does", "account", "with", "name", "337", "have", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Count the number of financial transactions that the account with the name 337 has.
SELECT count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = "337"
[ "SELECT", "count", "(", "*", ")", "FROM", "Financial_transactions", "AS", "T1", "JOIN", "Accounts", "AS", "T2", "ON", "T1.account_id", "=", "T2.account_id", "WHERE", "T2.account_name", "=", "``", "337", "''" ]
[ "select", "count", "(", "*", ")", "from", "financial_transactions", "as", "t1", "join", "accounts", "as", "t2", "on", "t1", ".", "account_id", "=", "t2", ".", "account_id", "where", "t2", ".", "account_name", "=", "value" ]
[ "Count", "the", "number", "of", "financial", "transactions", "that", "the", "account", "with", "the", "name", "337", "has", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What is the average, minimum, maximum, and total transaction amount?
SELECT avg(transaction_amount) , min(transaction_amount) , max(transaction_amount) , sum(transaction_amount) FROM Financial_transactions
[ "SELECT", "avg", "(", "transaction_amount", ")", ",", "min", "(", "transaction_amount", ")", ",", "max", "(", "transaction_amount", ")", ",", "sum", "(", "transaction_amount", ")", "FROM", "Financial_transactions" ]
[ "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", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Return the average, minimum, maximum, and total transaction amounts.
SELECT avg(transaction_amount) , min(transaction_amount) , max(transaction_amount) , sum(transaction_amount) FROM Financial_transactions
[ "SELECT", "avg", "(", "transaction_amount", ")", ",", "min", "(", "transaction_amount", ")", ",", "max", "(", "transaction_amount", ")", ",", "sum", "(", "transaction_amount", ")", "FROM", "Financial_transactions" ]
[ "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", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show ids for all transactions whose amounts are greater than the average.
SELECT transaction_id FROM Financial_transactions WHERE transaction_amount > (SELECT avg(transaction_amount) FROM Financial_transactions)
[ "SELECT", "transaction_id", "FROM", "Financial_transactions", "WHERE", "transaction_amount", ">", "(", "SELECT", "avg", "(", "transaction_amount", ")", "FROM", "Financial_transactions", ")" ]
[ "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", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What are the ids for transactions that have an amount greater than the average amount of a transaction?
SELECT transaction_id FROM Financial_transactions WHERE transaction_amount > (SELECT avg(transaction_amount) FROM Financial_transactions)
[ "SELECT", "transaction_id", "FROM", "Financial_transactions", "WHERE", "transaction_amount", ">", "(", "SELECT", "avg", "(", "transaction_amount", ")", "FROM", "Financial_transactions", ")" ]
[ "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", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show the transaction types and the total amount of transactions.
SELECT transaction_type , sum(transaction_amount) FROM Financial_transactions GROUP BY transaction_type
[ "SELECT", "transaction_type", ",", "sum", "(", "transaction_amount", ")", "FROM", "Financial_transactions", "GROUP", "BY", "transaction_type" ]
[ "select", "transaction_type", ",", "sum", "(", "transaction_amount", ")", "from", "financial_transactions", "group", "by", "transaction_type" ]
[ "Show", "the", "transaction", "types", "and", "the", "total", "amount", "of", "transactions", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What are total transaction amounts for each transaction type?
SELECT transaction_type , sum(transaction_amount) FROM Financial_transactions GROUP BY transaction_type
[ "SELECT", "transaction_type", ",", "sum", "(", "transaction_amount", ")", "FROM", "Financial_transactions", "GROUP", "BY", "transaction_type" ]
[ "select", "transaction_type", ",", "sum", "(", "transaction_amount", ")", "from", "financial_transactions", "group", "by", "transaction_type" ]
[ "What", "are", "total", "transaction", "amounts", "for", "each", "transaction", "type", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show the account name, id and the number of transactions for each account.
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
[ "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" ]
[ "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", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Return the names and ids of each account, as well as the number of transactions.
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
[ "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" ]
[ "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", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show the account id with most number of transactions.
SELECT account_id FROM Financial_transactions GROUP BY account_id ORDER BY count(*) DESC LIMIT 1
[ "SELECT", "account_id", "FROM", "Financial_transactions", "GROUP", "BY", "account_id", "ORDER", "BY", "count", "(", "*", ")", "DESC", "LIMIT", "1" ]
[ "select", "account_id", "from", "financial_transactions", "group", "by", "account_id", "order", "by", "count", "(", "*", ")", "desc", "limit", "value" ]
[ "Show", "the", "account", "id", "with", "most", "number", "of", "transactions", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What is the id of the account with the most transactions?
SELECT account_id FROM Financial_transactions GROUP BY account_id ORDER BY count(*) DESC LIMIT 1
[ "SELECT", "account_id", "FROM", "Financial_transactions", "GROUP", "BY", "account_id", "ORDER", "BY", "count", "(", "*", ")", "DESC", "LIMIT", "1" ]
[ "select", "account_id", "from", "financial_transactions", "group", "by", "account_id", "order", "by", "count", "(", "*", ")", "desc", "limit", "value" ]
[ "What", "is", "the", "id", "of", "the", "account", "with", "the", "most", "transactions", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show the account id and name with at least 4 transactions.
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
[ "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" ]
[ "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", "(", "*", ")", ">", "=", "value" ]
[ "Show", "the", "account", "id", "and", "name", "with", "at", "least", "4", "transactions", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What are the ids and names of accounts with 4 or more transactions?
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
[ "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" ]
[ "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", "(", "*", ")", ">", "=", "value" ]
[ "What", "are", "the", "ids", "and", "names", "of", "accounts", "with", "4", "or", "more", "transactions", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show all product sizes.
SELECT DISTINCT product_size FROM Products
[ "SELECT", "DISTINCT", "product_size", "FROM", "Products" ]
[ "select", "distinct", "product_size", "from", "products" ]
[ "Show", "all", "product", "sizes", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What are the different product sizes?
SELECT DISTINCT product_size FROM Products
[ "SELECT", "DISTINCT", "product_size", "FROM", "Products" ]
[ "select", "distinct", "product_size", "from", "products" ]
[ "What", "are", "the", "different", "product", "sizes", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show all product colors.
SELECT DISTINCT product_color FROM Products
[ "SELECT", "DISTINCT", "product_color", "FROM", "Products" ]
[ "select", "distinct", "product_color", "from", "products" ]
[ "Show", "all", "product", "colors", "." ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
What are the different product colors?
SELECT DISTINCT product_color FROM Products
[ "SELECT", "DISTINCT", "product_color", "FROM", "Products" ]
[ "select", "distinct", "product_color", "from", "products" ]
[ "What", "are", "the", "different", "product", "colors", "?" ]
customers_and_invoices
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);", "CREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);", "CREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);" ]
Show the invoice number and the number of transactions for each invoice.
SELECT invoice_number , count(*) FROM Financial_transactions GROUP BY invoice_number
[ "SELECT", "invoice_number", ",", "count", "(", "*", ")", "FROM", "Financial_transactions", "GROUP", "BY", "invoice_number" ]
[ "select", "invoice_number", ",", "count", "(", "*", ")", "from", "financial_transactions", "group", "by", "invoice_number" ]
[ "Show", "the", "invoice", "number", "and", "the", "number", "of", "transactions", "for", "each", "invoice", "." ]