data_source stringclasses 1 value | prompt listlengths 2 2 | ability stringclasses 1 value | reward_model dict | extra_info dict |
|---|---|---|---|---|
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2015-12-31', '2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['South', 'Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2015-12-31', '2015-01-08', '2015-01-07', '2015-01-03', '2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2015-12-31', '2015-01-01', '2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['South', 'Central']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2015-12-31', '2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2015-12-31', '2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2015-12-31', '2013-01-05', '2013-01-11']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the customers refers to Customer_Name; in 2015 refers to \"Order Date\" BETWEEN '2015-01-01' AND '2015-12-31'; more than 3 times refers to count(Order_ID) > 3\nAmong the customers in South superstore, which customers ordered more than 3 times in 2015? State the name of the customers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.`Customer Name` FROM south_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE STRFTIME('%Y', T1.`Order Date`) = '2015' GROUP BY T2.`Customer Name` HAVING COUNT(T2.`Customer Name`) > 3",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT DISTINCT T2.`Customer Name` FROM south_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE STRFTIME('%Y', T1.`Order Date`) = '2015' GROUP BY T2.`Customer Name` HAVING COUNT(T2.`Customer Name`) > 3",
"index": 1200,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2015-12-31', '2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['South', 'Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2015-12-31', '2015-01-08', '2015-01-07', '2015-01-03', '2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2015-12-31', '2015-01-01', '2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['South', 'Central']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2015-12-31', '2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2015-12-31', '2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2015-12-31', '2013-01-05', '2013-01-11']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the customers refers to Customer_Name; in 2015 refers to \"Order Date\" BETWEEN '2015-01-01' AND '2015-12-31'; more than 3 times refers to count(Order_ID) > 3\nAmong the customers in South superstore, which customers ordered more than 3 times in 2015? State the name of the customers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['West', 'East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['West', 'East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEast superstore refers to Region = 'East'; West superstore refers to Region = 'West'; difference = subtract(sum(Sales) when Region = 'East', sum(Sales) when Region = 'West')\nCalculate the difference between the total sales in the East superstore and the total sales in the West superstore.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T1.Sales) - SUM(T2.Sales) AS difference FROM east_superstore AS T1 INNER JOIN west_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID`",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT SUM(T1.Sales) - SUM(T2.Sales) AS difference FROM east_superstore AS T1 INNER JOIN west_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID`",
"index": 1201,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['West', 'East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['West', 'East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEast superstore refers to Region = 'East'; West superstore refers to Region = 'West'; difference = subtract(sum(Sales) when Region = 'East', sum(Sales) when Region = 'West')\nCalculate the difference between the total sales in the East superstore and the total sales in the West superstore.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2016-12-31', '2016-01-01', '2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2016-12-31', '2016-01-01', '2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2016-12-31', '2016-01-01', '2013-01-06', '2013-01-13']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Corporate', 'Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Rhode Island', 'Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2016-01-01', '2013-01-05', '2013-01-11']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2016-12-31', '2016-01-04', '2013-01-03', '2013-01-04']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncorporate customer refers to Segment = 'Corporate'; Rhode Island refers to State = 'Rhode Island'; in 2016 refers to \"Order Date\" BETWEEN '2016-01-01' AND '2016-12-31'; east superstore refers to Region = 'East'; highest number of orders refers to max(order_number); name of corporate customer refers to \"Customer Name\"\nWhat is the name of the corporate customer from Rhode Island who had the highest number of orders in 2016 from the east superstore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.`Customer Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T2.Segment = 'Corporate' AND T2.State = 'Rhode Island' AND T2.Region = 'East' AND STRFTIME('%Y', T1.`Order Date`) = '2016' GROUP BY T2.`Customer Name` ORDER BY COUNT(T2.`Customer Name`) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT T2.`Customer Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T2.Segment = 'Corporate' AND T2.State = 'Rhode Island' AND T2.Region = 'East' AND STRFTIME('%Y', T1.`Order Date`) = '2016' GROUP BY T2.`Customer Name` ORDER BY COUNT(T2.`Customer Name`) DESC LIMIT 1",
"index": 1202,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2016-12-31', '2016-01-01', '2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2016-12-31', '2016-01-01', '2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2016-12-31', '2016-01-01', '2013-01-06', '2013-01-13']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Corporate', 'Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Rhode Island', 'Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2016-01-01', '2013-01-05', '2013-01-11']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2016-12-31', '2016-01-04', '2013-01-03', '2013-01-04']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncorporate customer refers to Segment = 'Corporate'; Rhode Island refers to State = 'Rhode Island'; in 2016 refers to \"Order Date\" BETWEEN '2016-01-01' AND '2016-12-31'; east superstore refers to Region = 'East'; highest number of orders refers to max(order_number); name of corporate customer refers to \"Customer Name\"\nWhat is the name of the corporate customer from Rhode Island who had the highest number of orders in 2016 from the east superstore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Mode` text, -- example: ['First Class', 'Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Country text, -- example: ['United States']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norders with a quantity greater than 5 refers to Quantity > 5; shipped by the fastest delivery method refers to Ship Mode = 'First Class'\nHow many orders with a quantity greater than 5 have been shipped by the fastest delivery method?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT `Order ID`) FROM central_superstore WHERE Quantity > 5 AND `Ship Mode` = 'First Class'",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT `Order ID`) FROM central_superstore WHERE Quantity > 5 AND `Ship Mode` = 'First Class'",
"index": 1203,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Mode` text, -- example: ['First Class', 'Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Country text, -- example: ['United States']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norders with a quantity greater than 5 refers to Quantity > 5; shipped by the fastest delivery method refers to Ship Mode = 'First Class'\nHow many orders with a quantity greater than 5 have been shipped by the fastest delivery method?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Phillina Ober', 'Alex Avila', 'Allen Armold']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduct refers to \"Product Name\"\nWhich product did Phillina Ober buy?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T3.`Product Name` FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T1.`Customer Name` = 'Phillina Ober'",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT DISTINCT T3.`Product Name` FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T1.`Customer Name` = 'Phillina Ober'",
"index": 1204,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Phillina Ober', 'Alex Avila', 'Allen Armold']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduct refers to \"Product Name\"\nWhich product did Phillina Ober buy?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Hon Multipurpose Stacking Arm Chairs', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['South', 'Central']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['South', 'Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomer refers to \"Customer Name\"; “Hon Multipurpose Stacking Arm Chairs\" is the \"Product Name\";\nWho was the customer in the South Region superstore who bought the most “Hon Multipurpose Stacking Arm Chairs\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.`Customer Name` FROM south_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T3.`Product Name` = 'Hon Multipurpose Stacking Arm Chairs' GROUP BY T2.`Customer Name` ORDER BY COUNT(T2.`Customer Name`) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT T2.`Customer Name` FROM south_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T3.`Product Name` = 'Hon Multipurpose Stacking Arm Chairs' GROUP BY T2.`Customer Name` ORDER BY COUNT(T2.`Customer Name`) DESC LIMIT 1",
"index": 1205,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Hon Multipurpose Stacking Arm Chairs', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['South', 'Central']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['South', 'Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomer refers to \"Customer Name\"; “Hon Multipurpose Stacking Arm Chairs\" is the \"Product Name\";\nWho was the customer in the South Region superstore who bought the most “Hon Multipurpose Stacking Arm Chairs\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Hon Pagoda Stacking Chairs', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Chairs', 'Bookcases']\n Region text, -- example: ['West', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['West', 'Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHon Pagoda Stacking Chairs' is the \"Product Name\"; west superstore refers to Region = 'West'\nHow many of the \"Hon Pagoda Stacking Chairs\" have been sold in total in the west superstore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T1.Quantity) FROM west_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Hon Pagoda Stacking Chairs'",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT SUM(T1.Quantity) FROM west_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Hon Pagoda Stacking Chairs'",
"index": 1206,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Hon Pagoda Stacking Chairs', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Chairs', 'Bookcases']\n Region text, -- example: ['West', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['West', 'Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHon Pagoda Stacking Chairs' is the \"Product Name\"; west superstore refers to Region = 'West'\nHow many of the \"Hon Pagoda Stacking Chairs\" have been sold in total in the west superstore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Avery 5', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n Segment text, -- example: ['Consumer', 'Home Office']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Discount real, -- example: [0.2, 0.0]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Black Avery Flip-Chart Easel Binder\" is the \"Product Name\"; original price = divide(Sales, subtract(1, Discount))\nWhat is the original price of the \"Black Avery Flip-Chart Easel Binder\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Sales / (1 - T1.Discount) FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Blackstonian Pencils'",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT T1.Sales / (1 - T1.Discount) FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Blackstonian Pencils'",
"index": 1207,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Avery 5', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n Segment text, -- example: ['Consumer', 'Home Office']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Discount real, -- example: [0.2, 0.0]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Black Avery Flip-Chart Easel Binder\" is the \"Product Name\"; original price = divide(Sales, subtract(1, Discount))\nWhat is the original price of the \"Black Avery Flip-Chart Easel Binder\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Aimee Bixby', 'Alex Avila', 'Allen Armold']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the product refers to \"Product Name\"\nWhat is the name of the product that Aimee Bixby bought?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T3.`Product Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T2.`Customer Name` = 'Aimee Bixby'",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT DISTINCT T3.`Product Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T2.`Customer Name` = 'Aimee Bixby'",
"index": 1208,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Aimee Bixby', 'Alex Avila', 'Allen Armold']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the product refers to \"Product Name\"\nWhat is the name of the product that Aimee Bixby bought?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Quantity integer, -- example: [3, 2]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Standard Class', 'Second Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfurniture products refers to Category = 'Furniture'; shipped by standard class refers to \"Ship Mode\" = 'Standard Class'\nHow many furniture products had been shipped by standard class in the East superstore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.Category) FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Ship Mode` = 'Standard Class'",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT COUNT(T2.Category) FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Ship Mode` = 'Standard Class'",
"index": 1209,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Quantity integer, -- example: [3, 2]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Standard Class', 'Second Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfurniture products refers to Category = 'Furniture'; shipped by standard class refers to \"Ship Mode\" = 'Standard Class'\nHow many furniture products had been shipped by standard class in the East superstore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the products refers to Product Name; shipped in March 2013 refers to \"Ship Date\" = '2013-03%'\nWhat are the names of the products that had been shipped in March 2013 at central superstore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.`Product Name` FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE strftime('%Y-%m', T1.`Ship Date`) = '2013-03'",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT DISTINCT T2.`Product Name` FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE strftime('%Y-%m', T1.`Ship Date`) = '2013-03'",
"index": 1210,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the products refers to Product Name; shipped in March 2013 refers to \"Ship Date\" = '2013-03%'\nWhat are the names of the products that had been shipped in March 2013 at central superstore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n City text, -- example: ['Houston', 'Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomers from Houston, Texas refers to State = 'Texas' and City = 'Houston'; total profit = sum(Profit)\nAmong the customers from Houston, Texas, what is the total profit of their orders in the Central region?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T2.Profit) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T1.City = 'Houston' AND T1.State = 'Texas' AND T2.Region = 'Central'",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT SUM(T2.Profit) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T1.City = 'Houston' AND T1.State = 'Texas' AND T2.Region = 'Central'",
"index": 1211,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n City text, -- example: ['Houston', 'Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomers from Houston, Texas refers to State = 'Texas' and City = 'Houston'; total profit = sum(Profit)\nAmong the customers from Houston, Texas, what is the total profit of their orders in the Central region?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Ship Date` date, -- example: ['2013-03-05', '2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Quantity integer, -- example: [3, 2]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Quantity integer, -- example: [3, 5]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Ship Date` date, -- example: ['2013-03-05', '2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWho is the customer refers to Customer Name; shipped on March 5, 2013 refers to \"Ship Date\" = '2013-03-05'; eastern region refers to Region = 'East'\nWho is the customer with an order shipped on March 5, 2013, in the eastern region?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.`Customer Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Ship Date` = '2013-03-05'",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT DISTINCT T2.`Customer Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Ship Date` = '2013-03-05'",
"index": 1212,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Ship Date` date, -- example: ['2013-03-05', '2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Quantity integer, -- example: [3, 2]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Quantity integer, -- example: [3, 5]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Ship Date` date, -- example: ['2013-03-05', '2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWho is the customer refers to Customer Name; shipped on March 5, 2013 refers to \"Ship Date\" = '2013-03-05'; eastern region refers to Region = 'East'\nWho is the customer with an order shipped on March 5, 2013, in the eastern region?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-118976', 'CA-2011-141817', 'CA-2011-130092']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWho refers to \"Customer Name\"\nWho ordered the order ID CA-2011-118976 from the East region?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.`Customer Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Order ID` = 'CA-2011-118976' AND T2.Region = 'East'",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT DISTINCT T2.`Customer Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Order ID` = 'CA-2011-118976' AND T2.Region = 'East'",
"index": 1213,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-118976', 'CA-2011-141817', 'CA-2011-130092']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWho refers to \"Customer Name\"\nWho ordered the order ID CA-2011-118976 from the East region?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['US-2011-126571', 'CA-2011-141817', 'CA-2011-130092']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n City text, -- example: ['Round Rock', 'Omaha']\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList down the sales, profit, and subcategories of the product ordered in the order ID US-2011-126571 in the East region.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Sales, T1.Profit, T2.`Sub-Category` FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Order ID` = 'US-2011-126571' AND T2.Region = 'East'",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT T1.Sales, T1.Profit, T2.`Sub-Category` FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Order ID` = 'US-2011-126571' AND T2.Region = 'East'",
"index": 1214,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['US-2011-126571', 'CA-2011-141817', 'CA-2011-130092']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n City text, -- example: ['Round Rock', 'Omaha']\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList down the sales, profit, and subcategories of the product ordered in the order ID US-2011-126571 in the East region.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Indiana', 'Texas', 'Nebraska']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndiana refers to State = 'Indiana'; no discount refers to Discount = 0; percentage = divide(sum(Discount) when Discount = 0, count(Discount)) as percentage\nAmong the customers from Indiana, what is the percentage of their purchased orders in the Central region with no discount?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T2.Discount = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T2.Region = 'Central' AND T1.State = 'Indiana'",
"style": "rule"
} | {
"db_id": "superstore.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.Discount = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T2.Region = 'Central' AND T1.State = 'Indiana'",
"index": 1215,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Indiana', 'Texas', 'Nebraska']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndiana refers to State = 'Indiana'; no discount refers to Discount = 0; percentage = divide(sum(Discount) when Discount = 0, count(Discount)) as percentage\nAmong the customers from Indiana, what is the percentage of their purchased orders in the Central region with no discount?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['W', 'L', 'B']\n gender text, -- example: ['M', 'F']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['W', 'L']\n gender text, -- example: ['M', 'F']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to gender = 'M'; white refers to race = 'W'; percentage = divide(count(officers where race = 'W'), count(officers)) where gender = 'M' * 100%\nAmong all the male officers, what is the percentage of them are White?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(IIF(race = 'W', 1, 0)) AS REAL) * 100 / COUNT(case_number) FROM officers WHERE gender = 'M'",
"style": "rule"
} | {
"db_id": "shooting.sqlite",
"gt_sql": "SELECT CAST(SUM(IIF(race = 'W', 1, 0)) AS REAL) * 100 / COUNT(case_number) FROM officers WHERE gender = 'M'",
"index": 1216,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['W', 'L', 'B']\n gender text, -- example: ['M', 'F']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['W', 'L']\n gender text, -- example: ['M', 'F']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to gender = 'M'; white refers to race = 'W'; percentage = divide(count(officers where race = 'W'), count(officers)) where gender = 'M' * 100%\nAmong all the male officers, what is the percentage of them are White?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['M', 'F']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n subject_weapon text, -- example: ['Handgun', 'Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nyear refers to year(date); the greatest number of cases refers to max(count(case_number)); OS Spray was used as weapon refers to subject_weapon = 'OS Spray'\nIn which year has the greatest number of cases where Handgun was used as weapon?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT STRFTIME('%Y', date) FROM incidents WHERE subject_weapon = 'Handgun' GROUP BY STRFTIME('%Y', date) ORDER BY COUNT(case_number) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "shooting.sqlite",
"gt_sql": "SELECT STRFTIME('%Y', date) FROM incidents WHERE subject_weapon = 'Handgun' GROUP BY STRFTIME('%Y', date) ORDER BY COUNT(case_number) DESC LIMIT 1",
"index": 1217,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['M', 'F']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n subject_weapon text, -- example: ['Handgun', 'Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nyear refers to year(date); the greatest number of cases refers to max(count(case_number)); OS Spray was used as weapon refers to subject_weapon = 'OS Spray'\nIn which year has the greatest number of cases where Handgun was used as weapon?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n subject_statuses text, -- example: ['Shoot and Miss', 'Deceased']\n subject_weapon text, -- example: ['Handgun', 'Vehicle', 'Shotgun']\n subject_count integer, -- example: [1, 2]\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Curry', 'Chavez']\n first_name text, -- example: ['James', 'Gabriel']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'Handgun' weapon refers to subject_weapon = 'Handgun'; 'Shoot and Miss' refers to subject_statuses = 'Shoot and Miss'; percent = divide(count(incidents where subject_statuses = 'Shoot and Miss'), count(incidents)) where subject_weapon = 'Handgun' * 100%\nAmong the 'Handgun' weapon used by subject, how many percent were 'Shoot and Miss'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(subject_statuses = 'Shoot and Miss') AS REAL) * 100 / COUNT(case_number) FROM incidents WHERE subject_weapon = 'Handgun'",
"style": "rule"
} | {
"db_id": "shooting.sqlite",
"gt_sql": "SELECT CAST(SUM(subject_statuses = 'Shoot and Miss') AS REAL) * 100 / COUNT(case_number) FROM incidents WHERE subject_weapon = 'Handgun'",
"index": 1218,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n subject_statuses text, -- example: ['Shoot and Miss', 'Deceased']\n subject_weapon text, -- example: ['Handgun', 'Vehicle', 'Shotgun']\n subject_count integer, -- example: [1, 2]\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Curry', 'Chavez']\n first_name text, -- example: ['James', 'Gabriel']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'Handgun' weapon refers to subject_weapon = 'Handgun'; 'Shoot and Miss' refers to subject_statuses = 'Shoot and Miss'; percent = divide(count(incidents where subject_statuses = 'Shoot and Miss'), count(incidents)) where subject_weapon = 'Handgun' * 100%\nAmong the 'Handgun' weapon used by subject, how many percent were 'Shoot and Miss'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['F', 'M']\n last_name text, -- example: ['Patino', 'Fillingim']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n location text, -- example: ['7400 Bonnie View Road', '8218 Willoughby Boulevard']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n subject_weapon text, -- example: ['Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['F', 'M']\n first_name text, -- example: ['James', 'Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale refers to gender = 'F'; weapon refers to subject_weapon\nWhich are the cases where the subject are female. List the case number, subject status and weapon.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.case_number, T1.subject_statuses, T1.subject_weapon FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T2.gender = 'F'",
"style": "rule"
} | {
"db_id": "shooting.sqlite",
"gt_sql": "SELECT T1.case_number, T1.subject_statuses, T1.subject_weapon FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T2.gender = 'F'",
"index": 1219,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['F', 'M']\n last_name text, -- example: ['Patino', 'Fillingim']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n location text, -- example: ['7400 Bonnie View Road', '8218 Willoughby Boulevard']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n subject_weapon text, -- example: ['Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['F', 'M']\n first_name text, -- example: ['James', 'Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale refers to gender = 'F'; weapon refers to subject_weapon\nWhich are the cases where the subject are female. List the case number, subject status and weapon.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE incidents (\n case_number text, -- example: ['134472-2015', '031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['134472-2015', '44523A', '121982X']\n last_name text, -- example: ['Curry', 'Chavez']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['134472-2015', '44523A', '121982X']\n last_name text, -- example: ['Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor case number '134472-2015', list the last name of the officers involved and state the subject statuses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.last_name, T1.subject_statuses FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number WHERE T1.case_number = '134472-2015'",
"style": "rule"
} | {
"db_id": "shooting.sqlite",
"gt_sql": "SELECT T2.last_name, T1.subject_statuses FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number WHERE T1.case_number = '134472-2015'",
"index": 1220,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE incidents (\n case_number text, -- example: ['134472-2015', '031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['134472-2015', '44523A', '121982X']\n last_name text, -- example: ['Curry', 'Chavez']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['134472-2015', '44523A', '121982X']\n last_name text, -- example: ['Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor case number '134472-2015', list the last name of the officers involved and state the subject statuses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Curry', 'Chavez']\n first_name text, -- example: ['James', 'Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n location text, -- example: ['7400 Bonnie View Road', '8218 Willoughby Boulevard']\n subject_statuses text, -- example: ['Shoot and Miss', 'Injured', 'Deceased']\n subject_weapon text, -- example: ['Toy Handgun', 'Handgun', 'Knife', 'Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe 'Shoot and Miss' status refers to subject_statuses = 'Shoot and Miss'; knife refers to subject_weapon = 'knife'; toy handgun refers to subject_weapon = 'toy handgun'; ratio = divide(count(case_number where subject_weapon = 'knife'), count(case_number where subject_weapon = 'toy handgun')) where subject_statuses = 'Shoot and Miss'\nFrom the 'Injured' statuses of the subject, what is the ratio of weapons used are knife against handgun?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(T1.subject_weapon = 'Knife') AS REAL) * 100 / SUM(T1.subject_weapon = 'Handgun') FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T1.subject_statuses = 'Injured'",
"style": "rule"
} | {
"db_id": "shooting.sqlite",
"gt_sql": "SELECT CAST(SUM(T1.subject_weapon = 'Knife') AS REAL) * 100 / SUM(T1.subject_weapon = 'Handgun') FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T1.subject_statuses = 'Injured'",
"index": 1221,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Curry', 'Chavez']\n first_name text, -- example: ['James', 'Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n location text, -- example: ['7400 Bonnie View Road', '8218 Willoughby Boulevard']\n subject_statuses text, -- example: ['Shoot and Miss', 'Injured', 'Deceased']\n subject_weapon text, -- example: ['Toy Handgun', 'Handgun', 'Knife', 'Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe 'Shoot and Miss' status refers to subject_statuses = 'Shoot and Miss'; knife refers to subject_weapon = 'knife'; toy handgun refers to subject_weapon = 'toy handgun'; ratio = divide(count(case_number where subject_weapon = 'knife'), count(case_number where subject_weapon = 'toy handgun')) where subject_statuses = 'Shoot and Miss'\nFrom the 'Injured' statuses of the subject, what is the ratio of weapons used are knife against handgun?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n subject_weapon text, -- example: ['Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n subject_count integer, -- example: [1, 2]\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n last_name text, -- example: ['Curry', 'Chavez']\n first_name text, -- example: ['James', 'Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncase refers to case_number; year 2012 refers to date between '2012-01-01' and '2012-12-31'; subject was deceased refers to subject_statuses = 'Deceased'\nList all cases from the year 2012 in which the subject was deceased\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT case_number FROM incidents WHERE STRFTIME('%Y', date) > '2011' AND subject_statuses = 'Deceased'",
"style": "rule"
} | {
"db_id": "shooting.sqlite",
"gt_sql": "SELECT case_number FROM incidents WHERE STRFTIME('%Y', date) > '2011' AND subject_statuses = 'Deceased'",
"index": 1222,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n subject_weapon text, -- example: ['Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n subject_count integer, -- example: [1, 2]\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n last_name text, -- example: ['Curry', 'Chavez']\n first_name text, -- example: ['James', 'Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncase refers to case_number; year 2012 refers to date between '2012-01-01' and '2012-12-31'; subject was deceased refers to subject_statuses = 'Deceased'\nList all cases from the year 2012 in which the subject was deceased\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['F', 'M']\n last_name text, -- example: ['Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['F', 'M']\n last_name text, -- example: ['Curry', 'Chavez']\n first_name text, -- example: ['James', 'Gabriel']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n location text, -- example: ['7400 Bonnie View Road', '8218 Willoughby Boulevard']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n subject_weapon text, -- example: ['Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n subject_count integer, -- example: [1, 2]\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsubject's weapon was a vehicle refers to subject_weapon = 'Vehicle'; female refers to gender = 'F'\nHow many incidents in which the subject's weapon was a vehicle were investigated by a female officer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.case_number) FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number WHERE T1.subject_weapon = 'Vehicle' AND T2.gender = 'F'",
"style": "rule"
} | {
"db_id": "shooting.sqlite",
"gt_sql": "SELECT COUNT(T1.case_number) FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number WHERE T1.subject_weapon = 'Vehicle' AND T2.gender = 'F'",
"index": 1223,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['F', 'M']\n last_name text, -- example: ['Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['F', 'M']\n last_name text, -- example: ['Curry', 'Chavez']\n first_name text, -- example: ['James', 'Gabriel']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n location text, -- example: ['7400 Bonnie View Road', '8218 Willoughby Boulevard']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n subject_weapon text, -- example: ['Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n subject_count integer, -- example: [1, 2]\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsubject's weapon was a vehicle refers to subject_weapon = 'Vehicle'; female refers to gender = 'F'\nHow many incidents in which the subject's weapon was a vehicle were investigated by a female officer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['B', 'L']\n last_name text, -- example: ['Black', 'Curry', 'Chavez']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['B', 'L', 'W']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nblack refers to race = 'B'; between the years 2010 and 2015 refers to date between '2010-01-01' and '2015-12-31'; case refers to case_number\nOf the black officers, how many of them investigated cases between the years 2010 and 2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.case_number) FROM officers AS T1 INNER JOIN incidents AS T2 ON T2.case_number = T1.case_number WHERE T1.race = 'B' AND T2.date BETWEEN '2010-01-01' AND '2015-12-31'",
"style": "rule"
} | {
"db_id": "shooting.sqlite",
"gt_sql": "SELECT COUNT(T1.case_number) FROM officers AS T1 INNER JOIN incidents AS T2 ON T2.case_number = T1.case_number WHERE T1.race = 'B' AND T2.date BETWEEN '2010-01-01' AND '2015-12-31'",
"index": 1224,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['B', 'L']\n last_name text, -- example: ['Black', 'Curry', 'Chavez']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['B', 'L', 'W']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nblack refers to race = 'B'; between the years 2010 and 2015 refers to date between '2010-01-01' and '2015-12-31'; case refers to case_number\nOf the black officers, how many of them investigated cases between the years 2010 and 2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n location text, -- example: ['7400 Bonnie View Road', '8218 Willoughby Boulevard']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n subject_weapon text, -- example: ['Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n subject_count integer, -- example: [1, 2]\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Curry', 'Chavez']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most common type of weapon refers to max(count(subject_weapon)); causes death refers to subject_statuses = 'Deceased'\nWhat is the most common type of weapon that causes death?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT subject_weapon FROM incidents WHERE subject_statuses = 'Deceased' GROUP BY subject_weapon ORDER BY COUNT(case_number) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "shooting.sqlite",
"gt_sql": "SELECT subject_weapon FROM incidents WHERE subject_statuses = 'Deceased' GROUP BY subject_weapon ORDER BY COUNT(case_number) DESC LIMIT 1",
"index": 1225,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n location text, -- example: ['7400 Bonnie View Road', '8218 Willoughby Boulevard']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n subject_weapon text, -- example: ['Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n subject_count integer, -- example: [1, 2]\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Curry', 'Chavez']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most common type of weapon refers to max(count(subject_weapon)); causes death refers to subject_statuses = 'Deceased'\nWhat is the most common type of weapon that causes death?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['W', 'L', 'B']\n gender text, -- example: ['F', 'M']\n last_name text, -- example: ['White', 'Curry', 'Chavez']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['W', 'L']\n gender text, -- example: ['F', 'M']\n last_name text, -- example: ['White', 'Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n location text, -- example: ['7400 Bonnie View Road', '8218 Willoughby Boulevard']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhite refers to race = 'W'; male refers to gender = 'M'; female refers to gender = 'F'; proportion of white males = divide(count(officers where race = 'W' and gender = 'M'), count(officers)) * 100%; proportion of white females = divide(count(officers where race = 'W' and gender = 'F'), count(officers)) * 100%\nWhat is the proportion of white males and females in the police force?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(gender = 'M') AS REAL) / SUM(gender = 'F') FROM officers WHERE race = 'W'",
"style": "rule"
} | {
"db_id": "shooting.sqlite",
"gt_sql": "SELECT CAST(SUM(gender = 'M') AS REAL) / SUM(gender = 'F') FROM officers WHERE race = 'W'",
"index": 1226,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['W', 'L', 'B']\n gender text, -- example: ['F', 'M']\n last_name text, -- example: ['White', 'Curry', 'Chavez']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['W', 'L']\n gender text, -- example: ['F', 'M']\n last_name text, -- example: ['White', 'Patino', 'Fillingim']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n location text, -- example: ['7400 Bonnie View Road', '8218 Willoughby Boulevard']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhite refers to race = 'W'; male refers to gender = 'M'; female refers to gender = 'F'; proportion of white males = divide(count(officers where race = 'W' and gender = 'M'), count(officers)) * 100%; proportion of white females = divide(count(officers where race = 'W' and gender = 'F'), count(officers)) * 100%\nWhat is the proportion of white males and females in the police force?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['W', 'B', 'L']\n gender text, -- example: ['F', 'M']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['W', 'B', 'L']\n gender text, -- example: ['F', 'M']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nblack refers to race = 'B'; female refers to gender = 'F'; white refers to race = 'W'; result = subtract(count(victims where race = 'B'), count(victims where race = 'W')) where gender = 'F'\nHow many more black female victims than white female victims were discovered?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(race = 'B') - SUM(race = 'W') FROM subjects WHERE gender = 'F'",
"style": "rule"
} | {
"db_id": "shooting.sqlite",
"gt_sql": "SELECT SUM(race = 'B') - SUM(race = 'W') FROM subjects WHERE gender = 'F'",
"index": 1227,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['W', 'B', 'L']\n gender text, -- example: ['F', 'M']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['W', 'B', 'L']\n gender text, -- example: ['F', 'M']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nblack refers to race = 'B'; female refers to gender = 'F'; white refers to race = 'W'; result = subtract(count(victims where race = 'B'), count(victims where race = 'W')) where gender = 'F'\nHow many more black female victims than white female victims were discovered?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Curry', 'Chavez']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n location text, -- example: ['7400 Bonnie View Road', '8218 Willoughby Boulevard']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n subject_weapon text, -- example: ['Rifle', 'Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n subject_count integer, -- example: [1, 2]\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['M', 'F']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrifle refers to subject_weapon = 'rifles'; death refers to subject_statuses = 'Deceased'; percentage = divide(count(incidents where subject_weapon = 'rifles'), count(incidents)) where subject_statuses = 'Deceased' * 100%\nWhat percentage of deaths were caused by rifles?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(subject_statuses = 'Deceased') AS REAL) * 100 / COUNT(case_number) FROM incidents WHERE subject_weapon = 'Rifle'",
"style": "rule"
} | {
"db_id": "shooting.sqlite",
"gt_sql": "SELECT CAST(SUM(subject_statuses = 'Deceased') AS REAL) * 100 / COUNT(case_number) FROM incidents WHERE subject_weapon = 'Rifle'",
"index": 1228,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Curry', 'Chavez']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n location text, -- example: ['7400 Bonnie View Road', '8218 Willoughby Boulevard']\n subject_statuses text, -- example: ['Deceased', 'Shoot and Miss']\n subject_weapon text, -- example: ['Rifle', 'Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n subject_count integer, -- example: [1, 2]\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['M', 'F']\n first_name text, -- example: ['Michael', 'Brian']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrifle refers to subject_weapon = 'rifles'; death refers to subject_statuses = 'Deceased'; percentage = divide(count(incidents where subject_weapon = 'rifles'), count(incidents)) where subject_statuses = 'Deceased' * 100%\nWhat percentage of deaths were caused by rifles?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n subject_weapon text, -- example: ['Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['031347-2015', '44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['M', 'F']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['031347-2015', '44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['M', 'F']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype of weapon refers to subject_weapon; record number 031347-2015 refers to case_number = '031347-2015'\nWhich type of weapon was used to attack the victim in the record number 031347-2015? What is the victim's race and gender?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.subject_weapon, T2.race, T2.gender FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T1.case_number = '031347-2015'",
"style": "rule"
} | {
"db_id": "shooting.sqlite",
"gt_sql": "SELECT T1.subject_weapon, T2.race, T2.gender FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T1.case_number = '031347-2015'",
"index": 1229,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n subject_weapon text, -- example: ['Vehicle', 'Shotgun']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\n\nCREATE TABLE officers (\n case_number text, -- example: ['031347-2015', '44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['M', 'F']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['031347-2015', '44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['M', 'F']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype of weapon refers to subject_weapon; record number 031347-2015 refers to case_number = '031347-2015'\nWhich type of weapon was used to attack the victim in the record number 031347-2015? What is the victim's race and gender?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Ruben', 'Patino', 'Fillingim']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['M', 'F']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n location text, -- example: ['7400 Bonnie View Road', '8218 Willoughby Boulevard']\n subject_statuses text, -- example: ['Deceased Injured', 'Deceased', 'Injured', '2 Injured', 'Shoot and Miss']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n subject_count integer, -- example: [1, 2]\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnear-death refers to subject_statuses = 'Deceased Injured'; incident refers to case_number; Ruben Fredirick refers to full_name = 'Ruben Fredirick'\nWhich near-death incident did a policeman by the name of Ruben Fredirick look into? What is the victim in this incident's race and gender?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.case_number, T3.race, T3.gender FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number INNER JOIN subjects AS T3 ON T1.case_number = T3.case_number WHERE T2.first_name = 'Fredirick' AND T2.last_name = 'Ruben'",
"style": "rule"
} | {
"db_id": "shooting.sqlite",
"gt_sql": "SELECT T1.case_number, T3.race, T3.gender FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number INNER JOIN subjects AS T3 ON T1.case_number = T3.case_number WHERE T2.first_name = 'Fredirick' AND T2.last_name = 'Ruben'",
"index": 1230,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE officers (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'W']\n gender text, -- example: ['M', 'F']\n last_name text, -- example: ['Ruben', 'Patino', 'Fillingim']\n full_name text, -- example: ['Patino, Michael', 'Fillingim, Brian']\n CONSTRAINT fk_officers_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE subjects (\n case_number text, -- example: ['44523A', '121982X']\n race text, -- example: ['L', 'B']\n gender text, -- example: ['M', 'F']\n full_name text, -- example: ['Curry, James', 'Chavez, Gabriel']\n CONSTRAINT fk_subjects_case_number FOREIGN KEY (case_number) REFERENCES incidents (case_number)\n);\n\nCREATE TABLE incidents (\n case_number text, -- example: ['031347-2015', '072458-2016']\n `date` date, -- example: ['2015/2/9', '2016/3/26']\n location text, -- example: ['7400 Bonnie View Road', '8218 Willoughby Boulevard']\n subject_statuses text, -- example: ['Deceased Injured', 'Deceased', 'Injured', '2 Injured', 'Shoot and Miss']\n subjects text, -- example: ['Luster, Desmond Dwayne B/M', 'Gilstrap, Bryan B/M']\n subject_count integer, -- example: [1, 2]\n officers text, -- example: ['Tollerton, Aaron W/M', 'Cardenas, Steven L/M']\n PRIMARY KEY (case_number)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnear-death refers to subject_statuses = 'Deceased Injured'; incident refers to case_number; Ruben Fredirick refers to full_name = 'Ruben Fredirick'\nWhich near-death incident did a policeman by the name of Ruben Fredirick look into? What is the victim in this incident's race and gender?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['nucleus', 'cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Non-Essential', 'Essential']\n Class text, -- example: ['GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Complex text, -- example: ['Translation complexes', '?']\n Phenotype text, -- example: ['?', 'Mating and sporulation defects']\n Motif text, -- example: ['PS00824', 'PS00825']\n Chromosome integer, -- example: [1, 2]\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['nucleus', 'cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many non-essential genes are located in the nucleus?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID WHERE T2.Localization = 'nucleus' AND T1.Essential = 'Non-Essential'",
"style": "rule"
} | {
"db_id": "genes.sqlite",
"gt_sql": "SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID WHERE T2.Localization = 'nucleus' AND T1.Essential = 'Non-Essential'",
"index": 1231,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['nucleus', 'cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Non-Essential', 'Essential']\n Class text, -- example: ['GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Complex text, -- example: ['Translation complexes', '?']\n Phenotype text, -- example: ['?', 'Mating and sporulation defects']\n Motif text, -- example: ['PS00824', 'PS00825']\n Chromosome integer, -- example: [1, 2]\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['nucleus', 'cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many non-essential genes are located in the nucleus?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Essential', 'Non-Essential']\n Class text, -- example: ['GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Complex text, -- example: ['Translation complexes', '?']\n Phenotype text, -- example: ['Nucleic acid metabolism defects', '?', 'Mating and sporulation defects']\n Motif text, -- example: ['PS00824', 'PS00825']\n Chromosome integer, -- example: [1, 2]\n `Function` text, -- example: ['METABOLISM', 'CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['vacuole', 'cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['vacuole', 'cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmong the genes with nucleic acid metabolism defects, how many of them can be found in the vacuole?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID WHERE T2.Localization = 'vacuole' AND T1.Phenotype = 'Nucleic acid metabolism defects'",
"style": "rule"
} | {
"db_id": "genes.sqlite",
"gt_sql": "SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID WHERE T2.Localization = 'vacuole' AND T1.Phenotype = 'Nucleic acid metabolism defects'",
"index": 1232,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Essential', 'Non-Essential']\n Class text, -- example: ['GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Complex text, -- example: ['Translation complexes', '?']\n Phenotype text, -- example: ['Nucleic acid metabolism defects', '?', 'Mating and sporulation defects']\n Motif text, -- example: ['PS00824', 'PS00825']\n Chromosome integer, -- example: [1, 2]\n `Function` text, -- example: ['METABOLISM', 'CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['vacuole', 'cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['vacuole', 'cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmong the genes with nucleic acid metabolism defects, how many of them can be found in the vacuole?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Essential', 'Non-Essential']\n Class text, -- example: ['GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Phenotype text, -- example: ['?', 'Mating and sporulation defects']\n Motif text, -- example: ['PS00824', 'PS00825']\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['nucleus', 'cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['nucleus', 'cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmong the pairs of genes that are both located in the nucleus, what is the highest expression correlation score?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Expression_Corr FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 INNER JOIN Genes AS T3 ON T3.GeneID = T2.GeneID2 WHERE T1.Localization = 'nucleus' AND T3.Localization = 'nucleus' ORDER BY T2.Expression_Corr DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "genes.sqlite",
"gt_sql": "SELECT T2.Expression_Corr FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 INNER JOIN Genes AS T3 ON T3.GeneID = T2.GeneID2 WHERE T1.Localization = 'nucleus' AND T3.Localization = 'nucleus' ORDER BY T2.Expression_Corr DESC LIMIT 1",
"index": 1233,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Essential', 'Non-Essential']\n Class text, -- example: ['GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Phenotype text, -- example: ['?', 'Mating and sporulation defects']\n Motif text, -- example: ['PS00824', 'PS00825']\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['nucleus', 'cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['nucleus', 'cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmong the pairs of genes that are both located in the nucleus, what is the highest expression correlation score?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n PRIMARY KEY (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat are the functions of the pair of genes that have the lowest expression correlation score?a\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Function FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 ORDER BY T2.Expression_Corr ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "genes.sqlite",
"gt_sql": "SELECT T1.Function FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 ORDER BY T2.Expression_Corr ASC LIMIT 1",
"index": 1234,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n PRIMARY KEY (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat are the functions of the pair of genes that have the lowest expression correlation score?a\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Chromosome integer, -- example: [1, 2]\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor the pairs of genes with one having 8 chromosomes and the other having 6 chromosomes, what is the highest expression correlation score?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Expression_Corr FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Chromosome = 6 OR T1.Chromosome = 8 ORDER BY T2.Expression_Corr DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "genes.sqlite",
"gt_sql": "SELECT T2.Expression_Corr FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Chromosome = 6 OR T1.Chromosome = 8 ORDER BY T2.Expression_Corr DESC LIMIT 1",
"index": 1235,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Chromosome integer, -- example: [1, 2]\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor the pairs of genes with one having 8 chromosomes and the other having 6 chromosomes, what is the highest expression correlation score?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Class text, -- example: ['GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Phenotype text, -- example: ['?', 'Mating and sporulation defects']\n Motif text, -- example: ['PS00824', 'PS00825']\n Chromosome integer, -- example: [1, 2]\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlease list the motif of the genes that are located in the cytoplasm and have 7 chromosomes.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.GeneID1, T2.GeneID2 FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization = 'cytoplasm' AND T1.Chromosome = 7",
"style": "rule"
} | {
"db_id": "genes.sqlite",
"gt_sql": "SELECT T2.GeneID1, T2.GeneID2 FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization = 'cytoplasm' AND T1.Chromosome = 7",
"index": 1236,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Class text, -- example: ['GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Phenotype text, -- example: ['?', 'Mating and sporulation defects']\n Motif text, -- example: ['PS00824', 'PS00825']\n Chromosome integer, -- example: [1, 2]\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlease list the motif of the genes that are located in the cytoplasm and have 7 chromosomes.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Non-Essential', 'Essential']\n Class text, -- example: ['GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Complex text, -- example: ['Translation complexes', '?']\n `Function` text, -- example: ['TRANSCRIPTION', 'CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor the non-essential genes whose functions are transcription, how many of them are not located in the cytoplasm?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization != 'cytoplasm' AND T1.Function = 'TRANSCRIPTION' AND T1.Essential = 'NON-Essential'",
"style": "rule"
} | {
"db_id": "genes.sqlite",
"gt_sql": "SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization != 'cytoplasm' AND T1.Function = 'TRANSCRIPTION' AND T1.Essential = 'NON-Essential'",
"index": 1237,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Non-Essential', 'Essential']\n Class text, -- example: ['GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Complex text, -- example: ['Translation complexes', '?']\n `Function` text, -- example: ['TRANSCRIPTION', 'CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor the non-essential genes whose functions are transcription, how many of them are not located in the cytoplasm?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Essential', 'Non-Essential']\n Class text, -- example: ['ATPases', 'GTP/GDP-exchange factors (GEFs)']\n Complex text, -- example: ['Translation complexes', '?']\n Phenotype text, -- example: ['?', 'Mating and sporulation defects']\n Motif text, -- example: ['PS00824', 'PS00825']\n Chromosome integer, -- example: [1, 2]\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor the pairs of genes both from the class ATPases, what is the average expression correlation score?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(T2.Expression_Corr) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Class = 'ATPases'",
"style": "rule"
} | {
"db_id": "genes.sqlite",
"gt_sql": "SELECT AVG(T2.Expression_Corr) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Class = 'ATPases'",
"index": 1238,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Essential', 'Non-Essential']\n Class text, -- example: ['ATPases', 'GTP/GDP-exchange factors (GEFs)']\n Complex text, -- example: ['Translation complexes', '?']\n Phenotype text, -- example: ['?', 'Mating and sporulation defects']\n Motif text, -- example: ['PS00824', 'PS00825']\n Chromosome integer, -- example: [1, 2]\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor the pairs of genes both from the class ATPases, what is the average expression correlation score?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Class text, -- example: ['GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Phenotype text, -- example: ['?', 'Mating and sporulation defects']\n `Function` text, -- example: ['METABOLISM', 'CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLists all genes by identifier number located in the cytoplasm and whose function is metabolism.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT GeneID FROM Genes WHERE Localization = 'cytoplasm' AND Function = 'METABOLISM'",
"style": "rule"
} | {
"db_id": "genes.sqlite",
"gt_sql": "SELECT DISTINCT GeneID FROM Genes WHERE Localization = 'cytoplasm' AND Function = 'METABOLISM'",
"index": 1239,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Class text, -- example: ['GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Phenotype text, -- example: ['?', 'Mating and sporulation defects']\n `Function` text, -- example: ['METABOLISM', 'CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLists all genes by identifier number located in the cytoplasm and whose function is metabolism.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Physical', 'Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Essential', 'Non-Essential']\n Complex text, -- example: ['Translation complexes', '?']\n Phenotype text, -- example: ['?', 'Mating and sporulation defects']\n Chromosome integer, -- example: [1, 2]\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIf the Expression_Corr value is negative then it's negatively correlated. Percentage of Negative Correlation = count(negative Expression_Corr physical type) / count(Expression_Corr physical type) * 100%\nWhat kind of expression correlation occurs in physical type interacting gene pairs and what percentage of these are negatively correlated?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Expression_Corr FROM Interactions WHERE Type = 'Physical' UNION ALL SELECT CAST(SUM(Expression_Corr < 0) AS REAL) * 100 / COUNT(*) FROM Interactions WHERE Type = 'Physical'",
"style": "rule"
} | {
"db_id": "genes.sqlite",
"gt_sql": "SELECT Expression_Corr FROM Interactions WHERE Type = 'Physical' UNION ALL SELECT CAST(SUM(Expression_Corr < 0) AS REAL) * 100 / COUNT(*) FROM Interactions WHERE Type = 'Physical'",
"index": 1240,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Physical', 'Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Essential', 'Non-Essential']\n Complex text, -- example: ['Translation complexes', '?']\n Phenotype text, -- example: ['?', 'Mating and sporulation defects']\n Chromosome integer, -- example: [1, 2]\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIf the Expression_Corr value is negative then it's negatively correlated. Percentage of Negative Correlation = count(negative Expression_Corr physical type) / count(Expression_Corr physical type) * 100%\nWhat kind of expression correlation occurs in physical type interacting gene pairs and what percentage of these are negatively correlated?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['nucleus', 'cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Class text, -- example: ['GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Complex text, -- example: ['Translation complexes', '?']\n Localization text, -- example: ['nucleus', 'cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIf the Expression_Corr value is positive then it's positively correlated\nList all genes whose interaction is with genes located in the nucleus in which it is positively correlated.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.GeneID FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr > 0 AND T1.Localization = 'nucleus'",
"style": "rule"
} | {
"db_id": "genes.sqlite",
"gt_sql": "SELECT T1.GeneID FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr > 0 AND T1.Localization = 'nucleus'",
"index": 1241,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['nucleus', 'cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Class text, -- example: ['GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Complex text, -- example: ['Translation complexes', '?']\n Localization text, -- example: ['nucleus', 'cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIf the Expression_Corr value is positive then it's positively correlated\nList all genes whose interaction is with genes located in the nucleus in which it is positively correlated.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Essential', 'Non-Essential']\n Class text, -- example: ['Motorproteins', 'GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Phenotype text, -- example: ['Cell cycle defects', '?', 'Mating and sporulation defects']\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Physical', 'Genetic-Physical', 'Genetic']\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOf all the nonessential genes that are not of the motorprotein class and whose phenotype is cell cycle defects, how many do not have a physical type of interaction?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Type != 'Physical' AND T1.Phenotype = 'Cell cycle defects' AND T1.Class != 'Motorproteins' AND T1.Essential = 'Non-Essential'",
"style": "rule"
} | {
"db_id": "genes.sqlite",
"gt_sql": "SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Type != 'Physical' AND T1.Phenotype = 'Cell cycle defects' AND T1.Class != 'Motorproteins' AND T1.Essential = 'Non-Essential'",
"index": 1242,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Essential', 'Non-Essential']\n Class text, -- example: ['Motorproteins', 'GTP/GDP-exchange factors (GEFs)', 'ATPases']\n Phenotype text, -- example: ['Cell cycle defects', '?', 'Mating and sporulation defects']\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Physical', 'Genetic-Physical', 'Genetic']\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n PRIMARY KEY (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOf all the nonessential genes that are not of the motorprotein class and whose phenotype is cell cycle defects, how many do not have a physical type of interaction?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Essential', 'Non-Essential']\n Phenotype text, -- example: ['Nucleic acid metabolism defects', '?', 'Mating and sporulation defects']\n Motif text, -- example: ['PS00107', 'PS00824', 'PS00825']\n `Function` text, -- example: ['METABOLISM', 'CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPercentage of no interaction = [count(nucleic acid metabolism, PS00107, no interaction) / count(nucleic acid metabolism, PS00107) * 100%\nOf the genes whose phenotype and motif are nucleic acid metabolism defects, PS00107, what percentage perform positive interaction with another gene?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(IIF(T2.Expression_Corr > 0, 1, 0)) AS REAL) * 100 / COUNT(T2.GeneID1) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Phenotype = 'Nucleic acid metabolism defects' AND T1.Motif = 'PS00107'",
"style": "rule"
} | {
"db_id": "genes.sqlite",
"gt_sql": "SELECT CAST(SUM(IIF(T2.Expression_Corr > 0, 1, 0)) AS REAL) * 100 / COUNT(T2.GeneID1) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Phenotype = 'Nucleic acid metabolism defects' AND T1.Motif = 'PS00107'",
"index": 1243,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n PRIMARY KEY (GeneID)\n);\n\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Essential', 'Non-Essential']\n Phenotype text, -- example: ['Nucleic acid metabolism defects', '?', 'Mating and sporulation defects']\n Motif text, -- example: ['PS00107', 'PS00824', 'PS00825']\n `Function` text, -- example: ['METABOLISM', 'CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n Localization text, -- example: ['cytoplasm', 'cytoskeleton']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic-Physical', 'Genetic']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPercentage of no interaction = [count(nucleic acid metabolism, PS00107, no interaction) / count(nucleic acid metabolism, PS00107) * 100%\nOf the genes whose phenotype and motif are nucleic acid metabolism defects, PS00107, what percentage perform positive interaction with another gene?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Non-Essential', 'Essential']\n Motif text, -- example: ['PS00824', 'PS00825']\n Chromosome integer, -- example: [1, 2]\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic', 'Genetic-Physical']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n PRIMARY KEY (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIf the Expression_Corr value is negative then it's negatively correlated; Percentage of Essensity = [count(negatively correlated, genetical interaction, non-essential) / count(negatively correlated, genetical interaction, non-essential+negatively correlated, genetical interaction, essential)] * 100%\nWhich negatively correlated, genetically interacting genes are non-essential? What percentage do they represent with respect to those that are essential?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(COUNT(T1.GeneID) AS REAL) * 100 / ( SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 ) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 AND T1.Essential = 'Non-Essential'",
"style": "rule"
} | {
"db_id": "genes.sqlite",
"gt_sql": "SELECT CAST(COUNT(T1.GeneID) AS REAL) * 100 / ( SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 ) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 AND T1.Essential = 'Non-Essential'",
"index": 1244,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Genes (\n GeneID text, -- example: ['G234064', 'G234065']\n Essential text, -- example: ['Non-Essential', 'Essential']\n Motif text, -- example: ['PS00824', 'PS00825']\n Chromosome integer, -- example: [1, 2]\n `Function` text, -- example: ['CELLULAR ORGANIZATION (proteins are loca', 'PROTEIN SYNTHESIS']\n CONSTRAINT fk_genes_geneid FOREIGN KEY (GeneID) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Interactions (\n GeneID1 text, -- example: ['G234064', 'G234065']\n GeneID2 text, -- example: ['G234126', 'G235065']\n Type text, -- example: ['Genetic', 'Genetic-Physical']\n Expression_Corr real, -- Expression correlation score, example: [0.914095071, 0.751584888]\n PRIMARY KEY (GeneID1, GeneID2),\n CONSTRAINT fk_interactions_geneid1 FOREIGN KEY (GeneID1) REFERENCES Classification (GeneID),\n CONSTRAINT fk_interactions_geneid2 FOREIGN KEY (GeneID2) REFERENCES Classification (GeneID)\n);\n\nCREATE TABLE Classification (\n GeneID text, -- example: ['G234064', 'G234065']\n PRIMARY KEY (GeneID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIf the Expression_Corr value is negative then it's negatively correlated; Percentage of Essensity = [count(negatively correlated, genetical interaction, non-essential) / count(negatively correlated, genetical interaction, non-essential+negatively correlated, genetical interaction, essential)] * 100%\nWhich negatively correlated, genetically interacting genes are non-essential? What percentage do they represent with respect to those that are essential?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['HTC Weather', 'Weather', 'Google', 'Google+', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['WEATHER', 'ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Installs text, -- example: ['10,000+', '500,000+']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Weather', 'Art & Design', 'Art & Design;Pretend Play']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['HTC Weather', 'Google', 'Google+', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['Google play', 'User', 'how', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Neutral', 'Positive', 'nan']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuser holds neutral attitude refers to Sentiment = 'Neutral';\nHow many users holds neutral attitude towards the HTC Weather app? Indicate the app's rating on the Google Play Store.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.Rating), T1.Rating FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'HTC Weather' AND T2.Sentiment = 'Neutral'",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT COUNT(T1.Rating), T1.Rating FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'HTC Weather' AND T2.Sentiment = 'Neutral'",
"index": 1245,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['HTC Weather', 'Weather', 'Google', 'Google+', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['WEATHER', 'ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Installs text, -- example: ['10,000+', '500,000+']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Weather', 'Art & Design', 'Art & Design;Pretend Play']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['HTC Weather', 'Google', 'Google+', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['Google play', 'User', 'how', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Neutral', 'Positive', 'nan']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuser holds neutral attitude refers to Sentiment = 'Neutral';\nHow many users holds neutral attitude towards the HTC Weather app? Indicate the app's rating on the Google Play Store.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['Cooking Fever', 'Fever', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Cooking Fever', 'Fever', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage sentiment polarity score = AVG(Sentiment_Polarity); age group the app is target at refers to Content Rating;\nWhat is the average sentiment polarity score of the Cooking Fever app? Indicate the age group that the app is targeted at.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(T2.Sentiment_Polarity), T1.\"Content Rating\" FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Cooking Fever'",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT AVG(T2.Sentiment_Polarity), T1.\"Content Rating\" FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Cooking Fever'",
"index": 1246,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['Cooking Fever', 'Fever', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Cooking Fever', 'Fever', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage sentiment polarity score = AVG(Sentiment_Polarity); age group the app is target at refers to Content Rating;\nWhat is the average sentiment polarity score of the Cooking Fever app? Indicate the age group that the app is targeted at.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Rating real, -- example: [4.1, 3.9]\n Size text, -- example: ['19M', '14M']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nHow many apps have rating of 5?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(App) FROM playstore WHERE Rating = 5",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT COUNT(App) FROM playstore WHERE Rating = 5",
"index": 1247,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Rating real, -- example: [4.1, 3.9]\n Size text, -- example: ['19M', '14M']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nHow many apps have rating of 5?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['Top', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost reviewed app refers to MAX(Reviews);\nName the top 10 most reviewed apps.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT App FROM playstore ORDER BY Reviews DESC LIMIT 10",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT DISTINCT App FROM playstore ORDER BY Reviews DESC LIMIT 10",
"index": 1248,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['Top', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost reviewed app refers to MAX(Reviews);\nName the top 10 most reviewed apps.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['best', 'User', 'you', 'how', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Neutral', 'Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['10 Best Foods for You', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nneutral attitude refers to Sentiment = 'Neutral';\nHow many of the users hold neutral attitude on \"10 Best Foods for You\" app and what category is this app?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.App), T1.Category FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = '10 Best Foods for You' AND T2.Sentiment = 'Neutral'",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT COUNT(T2.App), T1.Category FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = '10 Best Foods for You' AND T2.Sentiment = 'Neutral'",
"index": 1249,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['best', 'User', 'you', 'how', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Neutral', 'Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['10 Best Foods for You', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nneutral attitude refers to Sentiment = 'Neutral';\nHow many of the users hold neutral attitude on \"10 Best Foods for You\" app and what category is this app?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nusers pretty much likes the app refers to Sentiment_Polarity = 'Positive';\nWhat are the apps that users pretty like this app and how many installs amount of these apps?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.App, T1.Installs FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment_Polarity > 0",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT DISTINCT T1.App, T1.Installs FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment_Polarity > 0",
"index": 1250,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nusers pretty much likes the app refers to Sentiment_Polarity = 'Positive';\nWhat are the apps that users pretty like this app and how many installs amount of these apps?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['The translator', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: [\"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest rating refers to Rating = 1;\nList apps whose rating is 3.9 and state the translated review of each app.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.App, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Rating = 3.9",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT T1.App, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Rating = 3.9",
"index": 1251,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['The translator', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: [\"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest rating refers to Rating = 1;\nList apps whose rating is 3.9 and state the translated review of each app.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['The translator', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n `Content Rating` text, -- example: ['Adults only 18+', 'Everyone', 'Teen']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: [\"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal installs = SUM(Installs);\nWhat is the total installs of apps with content rating of adults only 18+ and what are the translated reviews of it?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T1.Installs), T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.\"Content Rating\" = 'Adults only 18+'",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT SUM(T1.Installs), T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.\"Content Rating\" = 'Adults only 18+'",
"index": 1252,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['The translator', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n `Content Rating` text, -- example: ['Adults only 18+', 'Everyone', 'Teen']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: [\"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal installs = SUM(Installs);\nWhat is the total installs of apps with content rating of adults only 18+ and what are the translated reviews of it?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['The best', 'best', 'The best!', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbest selling app = MAX(MULTIPLY(Price, Installs));\nWhich of the app is the best selling app and what is the sentiments polarity of it?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.App, T2.Sentiment_Polarity FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App ORDER BY T1.Price * CAST(REPLACE(REPLACE(Installs, ',', ''), '+', '') AS INTEGER) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT T1.App, T2.Sentiment_Polarity FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App ORDER BY T1.Price * CAST(REPLACE(REPLACE(Installs, ',', ''), '+', '') AS INTEGER) DESC LIMIT 1",
"index": 1253,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['The best', 'best', 'The best!', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbest selling app = MAX(MULTIPLY(Price, Installs));\nWhich of the app is the best selling app and what is the sentiments polarity of it?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Draw A Stickman', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['Draw A Stickman', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: [\"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDraw A Stickman refers to App = 'Draw A Stickman';\nWhat is the rating for \"Draw A Stickman\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Rating FROM playstore WHERE APP = 'Draw A Stickman'",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT Rating FROM playstore WHERE APP = 'Draw A Stickman'",
"index": 1254,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Draw A Stickman', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['Draw A Stickman', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: [\"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDraw A Stickman refers to App = 'Draw A Stickman';\nWhat is the rating for \"Draw A Stickman\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['Top', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['O Shopping', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['SHOPPING', 'ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Genres text, -- example: ['Shopping', 'Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshopping apps refers to Genre = 'Shopping'; most reviews refers to MAX(Reviews);\nList the top 5 shopping apps with the most reviews.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT App FROM playstore WHERE Genres = 'Shopping' GROUP BY App ORDER BY COUNT(App) DESC LIMIT 5",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT DISTINCT App FROM playstore WHERE Genres = 'Shopping' GROUP BY App ORDER BY COUNT(App) DESC LIMIT 5",
"index": 1255,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['Top', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['O Shopping', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['SHOPPING', 'ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Genres text, -- example: ['Shopping', 'Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshopping apps refers to Genre = 'Shopping'; most reviews refers to MAX(Reviews);\nList the top 5 shopping apps with the most reviews.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Dino War: Rise of Beasts', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Reviews integer, -- example: [159, 967]\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['Dino War: Rise of Beasts', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Sentiment text, -- example: ['Neutral', 'Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nneutral reviews refers to Sentiment = 'Neutral';\nHow many neutral reviews does the app \"Dino War: Rise of Beasts\" have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(App) FROM user_reviews WHERE App = 'Dino War: Rise of Beasts' AND Sentiment = 'Neutral'",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT COUNT(App) FROM user_reviews WHERE App = 'Dino War: Rise of Beasts' AND Sentiment = 'Neutral'",
"index": 1256,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Dino War: Rise of Beasts', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Reviews integer, -- example: [159, 967]\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['Dino War: Rise of Beasts', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Sentiment text, -- example: ['Neutral', 'Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nneutral reviews refers to Sentiment = 'Neutral';\nHow many neutral reviews does the app \"Dino War: Rise of Beasts\" have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['All', 'how', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Negative', 'Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['100,000,000+', '10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnegative comment refers to Sentiment = 'Negative'; Installs = '100,000,000+';\nHow many negative comments are there in all the apps with 100,000,000+ installs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.Sentiment) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Installs = '100,000,000+' AND T2.Sentiment = 'Negative'",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT COUNT(T2.Sentiment) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Installs = '100,000,000+' AND T2.Sentiment = 'Negative'",
"index": 1257,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['All', 'how', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Negative', 'Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['100,000,000+', '10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnegative comment refers to Sentiment = 'Negative'; Installs = '100,000,000+';\nHow many negative comments are there in all the apps with 100,000,000+ installs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['most expensive app (H)', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Reviews integer, -- example: [159, 967]\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal sentiment polarity score = sum(Sentiment_Polarity); most expensive app refers to MAX(Price);\nWhat is the total Sentiment polarity score of the most expensive app?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T2.Sentiment_Polarity) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Price = ( SELECT MAX(Price) FROM playstore )",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT SUM(T2.Sentiment_Polarity) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Price = ( SELECT MAX(Price) FROM playstore )",
"index": 1258,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['most expensive app (H)', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Reviews integer, -- example: [159, 967]\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal sentiment polarity score = sum(Sentiment_Polarity); most expensive app refers to MAX(Price);\nWhat is the total Sentiment polarity score of the most expensive app?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Golfshot Plus: Golf GPS', 'Garden Coloring Book', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['Golfshot Plus: Golf GPS', 'Garden Coloring Book', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['Its', 'All', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGolfshot Plus: Golf GPS refers to App = 'Golfshot Plus: Golf GPS'; review refers to Translated_Review;\nWhat is the rating for \"Garden Coloring Book\"? List all of its reviews.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Rating, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Garden Coloring Book'",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT T1.Rating, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Garden Coloring Book'",
"index": 1259,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Golfshot Plus: Golf GPS', 'Garden Coloring Book', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['Golfshot Plus: Golf GPS', 'Garden Coloring Book', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['Its', 'All', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGolfshot Plus: Golf GPS refers to App = 'Golfshot Plus: Golf GPS'; review refers to Translated_Review;\nWhat is the rating for \"Garden Coloring Book\"? List all of its reviews.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['BK Photography', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['PHOTOGRAPHY', 'ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Genres text, -- example: ['Photography', 'Art & Design', 'Art & Design;Pretend Play']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: [\"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPhotography app refers to Genre = 'Photography'; highest total sentiment subjectivity score = MAX(sum(Sentiment_Subjectivity));\nWhich Photography app has the highest total Sentiment subjectivity score?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.App FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Genres = 'Photography' GROUP BY T1.App ORDER BY SUM(T2.Sentiment_Subjectivity) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT T1.App FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Genres = 'Photography' GROUP BY T1.App ORDER BY SUM(T2.Sentiment_Subjectivity) DESC LIMIT 1",
"index": 1260,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['BK Photography', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['PHOTOGRAPHY', 'ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Genres text, -- example: ['Photography', 'Art & Design', 'Art & Design;Pretend Play']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: [\"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPhotography app refers to Genre = 'Photography'; highest total sentiment subjectivity score = MAX(sum(Sentiment_Subjectivity));\nWhich Photography app has the highest total Sentiment subjectivity score?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['1,000,000,000+', '10,000+', '500,000+']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['No comment', 'No comments', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno comment refers to Translated_Review = 'nan'; most no comment reviews = (MAX(COUNT(Translated_Review = 'nan')));\nWhich 1,000,000,000+ intalls apps has the most no comment reviews?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.App FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Installs = '1,000,000+' AND T2.Translated_Review = 'nan' GROUP BY T1.App ORDER BY COUNT(T2.Translated_Review) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT T1.App FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Installs = '1,000,000+' AND T2.Translated_Review = 'nan' GROUP BY T1.App ORDER BY COUNT(T2.Translated_Review) DESC LIMIT 1",
"index": 1261,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['1,000,000,000+', '10,000+', '500,000+']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['No comment', 'No comments', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno comment refers to Translated_Review = 'nan'; most no comment reviews = (MAX(COUNT(Translated_Review = 'nan')));\nWhich 1,000,000,000+ intalls apps has the most no comment reviews?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['No comment', 'No comments', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Teen', 'Everyone']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno comment refers to Translated_Review = 'nan'; percentage = DIVIDE((SUM(Content Rating = 'Teen')), COUNT(*));\nWhat percentage of no comment reviews are from \"Teen\" content rating apps?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(COUNT(CASE WHEN T1.`Content Rating` = 'Teen' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.App) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Translated_Review = 'nan'",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T1.`Content Rating` = 'Teen' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.App) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Translated_Review = 'nan'",
"index": 1262,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['No comment', 'No comments', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Teen', 'Everyone']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno comment refers to Translated_Review = 'nan'; percentage = DIVIDE((SUM(Content Rating = 'Teen')), COUNT(*));\nWhat percentage of no comment reviews are from \"Teen\" content rating apps?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: [\"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n `Content Rating` text, -- example: ['Teen', 'Everyone']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nReviews>75000000; suitable for teenagers refers to Content Rating = 'Teen';\nWhich apps have been reviewed more than 75 000 000 times and the content is suitable for teenagers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT App FROM playstore WHERE Reviews > 75000000 AND `Content Rating` = 'Teen'",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT DISTINCT App FROM playstore WHERE Reviews > 75000000 AND `Content Rating` = 'Teen'",
"index": 1263,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: [\"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n `Content Rating` text, -- example: ['Teen', 'Everyone']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nReviews>75000000; suitable for teenagers refers to Content Rating = 'Teen';\nWhich apps have been reviewed more than 75 000 000 times and the content is suitable for teenagers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage review = AVG(Review); application refers to app; Rating = 5;\nWhat is the average review number for application with 5 rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(Reviews) FROM playstore WHERE Rating = 5",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT AVG(Reviews) FROM playstore WHERE Rating = 5",
"index": 1264,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage review = AVG(Review); application refers to app; Rating = 5;\nWhat is the average review number for application with 5 rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['Average', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Negative', 'Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Reviews integer, -- example: [159, 967]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndoest not have negative sentiment refers to Sentiment! = 'Negative'; average = AVG(Sentiment_Polarity);\nList down app that does not have negative sentiment and give their average rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.App, AVG(T2.Sentiment_Polarity) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment != 'Negative' GROUP BY T1.App",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT T1.App, AVG(T2.Sentiment_Polarity) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment != 'Negative' GROUP BY T1.App",
"index": 1265,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['Average', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Negative', 'Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Reviews integer, -- example: [159, 967]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndoest not have negative sentiment refers to Sentiment! = 'Negative'; average = AVG(Sentiment_Polarity);\nList down app that does not have negative sentiment and give their average rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Honkai Impact 3rd', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Reviews integer, -- example: [159, 967]\n Installs text, -- example: ['10,000+', '500,000+']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['Honkai Impact 3rd', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHonkai Impact 3rd is the App;\nWhat genre does Honkai Impact 3rd belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT Genres FROM playstore WHERE App = 'Honkai Impact 3rd'",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT DISTINCT Genres FROM playstore WHERE App = 'Honkai Impact 3rd'",
"index": 1266,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Honkai Impact 3rd', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Reviews integer, -- example: [159, 967]\n Installs text, -- example: ['10,000+', '500,000+']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['Honkai Impact 3rd', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHonkai Impact 3rd is the App;\nWhat genre does Honkai Impact 3rd belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Rating real, -- example: [4.1, 3.9]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10+', '10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone 10+', 'Everyone', 'Teen']\n Genres text, -- example: ['Arcade', 'Art & Design', 'Art & Design;Pretend Play']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage price = AVG(Price);\nWhat is the average price of games belonging in the arcade genre which has a content rating of Everyone 10+?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(Price) FROM playstore WHERE 'Content Rating' = 'Everyone 10+' AND Genres = 'Arcade'",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT AVG(Price) FROM playstore WHERE 'Content Rating' = 'Everyone 10+' AND Genres = 'Arcade'",
"index": 1267,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Rating real, -- example: [4.1, 3.9]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10+', '10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone 10+', 'Everyone', 'Teen']\n Genres text, -- example: ['Arcade', 'Art & Design', 'Art & Design;Pretend Play']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage price = AVG(Price);\nWhat is the average price of games belonging in the arcade genre which has a content rating of Everyone 10+?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Browser 4G', 'X Browser', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['Browser 4G', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['User', 'how', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBrowser 4G is the App; pretty positive favorability refers to Sentiment_Polarity score = 0.5\nHow much is the size of Browser 4G and how many users have a pretty positive favorability on it?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Size, COUNT(T1.App) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Browser 4G' AND T2.Sentiment_Polarity >= 0.5",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT T1.Size, COUNT(T1.App) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Browser 4G' AND T2.Sentiment_Polarity >= 0.5",
"index": 1268,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Browser 4G', 'X Browser', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Art & Design', 'Art & Design;Pretend Play']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['Browser 4G', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['User', 'how', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment text, -- example: ['Positive', 'nan']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBrowser 4G is the App; pretty positive favorability refers to Sentiment_Polarity score = 0.5\nHow much is the size of Browser 4G and how many users have a pretty positive favorability on it?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Genres text, -- example: ['Puzzle', 'Art & Design', 'Art & Design;Pretend Play']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Sentiment text, -- example: ['Negative', 'Positive', 'nan']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest rating refers to MIN(Rating); puzzle is the genre;\nList the top 5 lowest rated puzzle games and count the number of negative sentiments the games received.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.App, COUNT(T1.App) COUNTNUMBER FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment = 'Negative' GROUP BY T1.App ORDER BY T1.Rating LIMIT 5",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT T1.App, COUNT(T1.App) COUNTNUMBER FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment = 'Negative' GROUP BY T1.App ORDER BY T1.Rating LIMIT 5",
"index": 1269,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE playstore (\n App text, -- example: ['Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Genres text, -- example: ['Puzzle', 'Art & Design', 'Art & Design;Pretend Play']\n);\n\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Sentiment text, -- example: ['Negative', 'Positive', 'nan']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest rating refers to MIN(Rating); puzzle is the genre;\nList the top 5 lowest rated puzzle games and count the number of negative sentiments the games received.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['The worst', 'worst', 'Worst', 'The worst.', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['The translator', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['EDUCATION', 'ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Genres text, -- example: ['Education', 'Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neducation App refers to Category = 'EDUCATION'; worst rated app refers to Rating = 1;\nWhich education App has the worst rating and state the translated review if available.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.App, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Category = 'EDUCATION' GROUP BY T1.App, T2.Translated_Review ORDER BY T1.Rating ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT T1.App, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Category = 'EDUCATION' GROUP BY T1.App, T2.Translated_Review ORDER BY T1.Rating ASC LIMIT 1",
"index": 1270,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['The worst', 'worst', 'Worst', 'The worst.', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['The translator', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['EDUCATION', 'ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Genres text, -- example: ['Education', 'Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neducation App refers to Category = 'EDUCATION'; worst rated app refers to Rating = 1;\nWhich education App has the worst rating and state the translated review if available.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['Free Sports TV', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['All', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Free Sports TV', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['SPORTS', 'ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Sports', 'Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npaid sports Apps refers to type = 'Paid' and Category = 'SPORTS';\nList all free sports Apps and their translated review.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.App, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Type = 'Free' AND T1.Category = 'SPORTS'",
"style": "rule"
} | {
"db_id": "app_store.sqlite",
"gt_sql": "SELECT T1.App, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Type = 'Free' AND T1.Category = 'SPORTS'",
"index": 1271,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE user_reviews (\n App text, -- example: ['Free Sports TV', '10 Best Foods for You', '104 找工作 - 找工作 找打工 找兼職 履歷健檢 履歷診療室']\n Translated_Review text, -- example: ['All', \"I like eat delicious food. That's I'm co\", 'This help eating healthy exercise regula']\n Sentiment_Polarity text, -- example: ['1.0', '0.25']\n Sentiment_Subjectivity text, -- example: ['0.5333333333333333', '0.28846153846153844']\n CONSTRAINT fk_user_reviews_app FOREIGN KEY (App) REFERENCES playstore (App)\n);\n\nCREATE TABLE playstore (\n App text, -- example: ['Free Sports TV', 'Photo Editor & Candy Camera & Grid & Scr', 'Coloring book moana']\n Category text, -- example: ['SPORTS', 'ART_AND_DESIGN', 'AUTO_AND_VEHICLES']\n Rating real, -- example: [4.1, 3.9]\n Reviews integer, -- example: [159, 967]\n Size text, -- example: ['19M', '14M']\n Installs text, -- example: ['10,000+', '500,000+']\n Type text, -- example: ['Free', 'Paid']\n Price text, -- example: ['0', '$4.99']\n `Content Rating` text, -- example: ['Everyone', 'Teen']\n Genres text, -- example: ['Sports', 'Art & Design', 'Art & Design;Pretend Play']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npaid sports Apps refers to type = 'Paid' and Category = 'SPORTS';\nList all free sports Apps and their translated review.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAVG(Median Income) where Type = 'City';\nWhat is the average median income for all City type of stores?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(`Median Income`) FROM `Store Locations` WHERE Type = 'City'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT AVG(`Median Income`) FROM `Store Locations` WHERE Type = 'City'",
"index": 1272,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAVG(Median Income) where Type = 'City';\nWhat is the average median income for all City type of stores?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 000137', 'SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nName the sales team and the region of order number 'SO - 000137'.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.`Sales Team`, T2.Region FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.OrderNumber = 'SO - 000137'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T2.`Sales Team`, T2.Region FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.OrderNumber = 'SO - 000137'",
"index": 1273,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 000137', 'SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nName the sales team and the region of order number 'SO - 000137'.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Douglas Tucker', 'Adam Hernandez', 'Keith Griffin']\n PRIMARY KEY (SalesTeamID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all the order numbers along with its product name for each order under the sales team of 'Douglas Tucker'.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.ProductID, T1.`Product Name` FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Sales Team` AS T3 ON T3.SalesTeamID = T2._SalesTeamID WHERE T3.`Sales Team` = 'Douglas Tucker'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT T1.ProductID, T1.`Product Name` FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Sales Team` AS T3 ON T3.SalesTeamID = T2._SalesTeamID WHERE T3.`Sales Team` = 'Douglas Tucker'",
"index": 1274,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Douglas Tucker', 'Adam Hernandez', 'Keith Griffin']\n PRIMARY KEY (SalesTeamID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all the order numbers along with its product name for each order under the sales team of 'Douglas Tucker'.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\n Longitude real, -- example: [-86.79905, -86.67298]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cocktail Glasses', 'Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMAX(Discount Applied) where Product Name = 'Cocktail Glasses'; orders in 2020 refer to the OrderDate between 01-01-2020 and 31-12-2020;\nAmong orders in 2020, name the customers who had the greatest discount applied for 'Cocktail Glasses'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.`Customer Names` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products AS T3 ON T3.ProductID = T2._ProductID WHERE T3.`Product Name` = 'Cocktail Glasses' AND SUBSTR(T2.OrderDate, -2) = '20' AND T2.`Discount Applied` = ( SELECT T2.`Discount Applied` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products AS T3 ON T3.ProductID = T2._ProductID WHERE T3.`Product Name` = 'Cocktail Glasses' AND T2.OrderDate LIKE '%/%/20' ORDER BY T2.`Discount Applied` DESC LIMIT 1 )",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT T1.`Customer Names` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products AS T3 ON T3.ProductID = T2._ProductID WHERE T3.`Product Name` = 'Cocktail Glasses' AND SUBSTR(T2.OrderDate, -2) = '20' AND T2.`Discount Applied` = ( SELECT T2.`Discount Applied` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products AS T3 ON T3.ProductID = T2._ProductID WHERE T3.`Product Name` = 'Cocktail Glasses' AND T2.OrderDate LIKE '%/%/20' ORDER BY T2.`Discount Applied` DESC LIMIT 1 )",
"index": 1275,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\n Longitude real, -- example: [-86.79905, -86.67298]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cocktail Glasses', 'Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMAX(Discount Applied) where Product Name = 'Cocktail Glasses'; orders in 2020 refer to the OrderDate between 01-01-2020 and 31-12-2020;\nAmong orders in 2020, name the customers who had the greatest discount applied for 'Cocktail Glasses'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most expensive refers to MAX(Unit Cost); who refers to Customer Names; when refers to OrderDate;\nName the most expensive ordered? Who, when was it ordered?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.OrderNumber, T1.`Customer Names`, T2.OrderDate FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products AS T3 ON T3.ProductID = T2._ProductID ORDER BY T2.`Unit Cost` DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T2.OrderNumber, T1.`Customer Names`, T2.OrderDate FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products AS T3 ON T3.ProductID = T2._ProductID ORDER BY T2.`Unit Cost` DESC LIMIT 1",
"index": 1276,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most expensive refers to MAX(Unit Cost); who refers to Customer Names; when refers to OrderDate;\nName the most expensive ordered? Who, when was it ordered?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n `Median Income` integer, -- example: [31061, 48775]\n `Water Area` integer, -- example: [6591013, 3452021]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n WarehouseCode text, -- example: ['WARE-NMK1003', 'WARE-UHY1004']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nall the orders from WARE-NMK1003 refer to OrderNumber where WarehouseCode = 'WARE-NMK1003'; product refers to Product Name;\nProvide all the orders from WARE-NMK1003. Name the product and sales team for each of these order.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.`Product Name`, T3.`Sales Team` FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Sales Team` AS T3 ON T3.SalesTeamID = T2._SalesTeamID WHERE T2.WarehouseCode = 'WARE-NMK1003'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT T1.`Product Name`, T3.`Sales Team` FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Sales Team` AS T3 ON T3.SalesTeamID = T2._SalesTeamID WHERE T2.WarehouseCode = 'WARE-NMK1003'",
"index": 1277,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n `Median Income` integer, -- example: [31061, 48775]\n `Water Area` integer, -- example: [6591013, 3452021]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n WarehouseCode text, -- example: ['WARE-NMK1003', 'WARE-UHY1004']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nall the orders from WARE-NMK1003 refer to OrderNumber where WarehouseCode = 'WARE-NMK1003'; product refers to Product Name;\nProvide all the orders from WARE-NMK1003. Name the product and sales team for each of these order.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['Online', 'In-Store']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norders online refer to Sales Channel = 'Online';\nList the name of all customers who had made orders online.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T FROM ( SELECT CASE WHEN T2.`Sales Channel` = 'Online' THEN T1.`Customer Names` ELSE NULL END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T FROM ( SELECT CASE WHEN T2.`Sales Channel` = 'Online' THEN T1.`Customer Names` ELSE NULL END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL",
"index": 1278,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['Online', 'In-Store']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norders online refer to Sales Channel = 'Online';\nList the name of all customers who had made orders online.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n Population integer, -- example: [212461, 190582]\n `Median Income` integer, -- example: [31061, 48775]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnet profit can be computed as SUBTRACT(Unit Price, Unit Cost); the greatest net profit in 2020 refers to MAX(net profit) where OrderDate LIKE '%/20';\nName the sales team name who had orders with the greatest net profit in 2020.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.OrderDate LIKE '%/%/20' GROUP BY T2.`Sales Team` ORDER BY SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.OrderDate LIKE '%/%/20' GROUP BY T2.`Sales Team` ORDER BY SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) DESC LIMIT 1",
"index": 1279,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n Population integer, -- example: [212461, 190582]\n `Median Income` integer, -- example: [31061, 48775]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnet profit can be computed as SUBTRACT(Unit Price, Unit Cost); the greatest net profit in 2020 refers to MAX(net profit) where OrderDate LIKE '%/20';\nName the sales team name who had orders with the greatest net profit in 2020.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Joshua Bennett', 'Adam Hernandez', 'Keith Griffin']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n Population integer, -- example: [212461, 190582]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnet profit can be computed as SUBTRACT(Unit Price, Unit Cost); Joshua Bennett is the name of Sales Team;\nSate the order number and calculate the net profit for each order under Joshua Bennett.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.OrderNumber , REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.`Sales Team` = 'Joshua Bennett'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T1.OrderNumber , REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.`Sales Team` = 'Joshua Bennett'",
"index": 1280,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Joshua Bennett', 'Adam Hernandez', 'Keith Griffin']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n Population integer, -- example: [212461, 190582]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnet profit can be computed as SUBTRACT(Unit Price, Unit Cost); Joshua Bennett is the name of Sales Team;\nSate the order number and calculate the net profit for each order under Joshua Bennett.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Home Fragrances', 'Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipped in July 2018 refers to ShipDate between 01-07-2018 and 31-07-2018; DIVIDE(COUNT(OrderNumber where Product Name = 'Home Fragrances' and SUBSTR(OrderDate, 1, 1) = '7'), COUNT(OrderNumber where SUBSTR(ShipDate, -2) = '18')) as percentage;\nAmong the sales order shipped in July 2018, calculate the percentage of orders for home fragrances.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN T2.`Product Name` = 'Home Fragrances' THEN 1 ELSE 0 END) * 100 / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T1.ShipDate LIKE '7/%/18'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.`Product Name` = 'Home Fragrances' THEN 1 ELSE 0 END) * 100 / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T1.ShipDate LIKE '7/%/18'",
"index": 1281,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Home Fragrances', 'Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipped in July 2018 refers to ShipDate between 01-07-2018 and 31-07-2018; DIVIDE(COUNT(OrderNumber where Product Name = 'Home Fragrances' and SUBSTR(OrderDate, 1, 1) = '7'), COUNT(OrderNumber where SUBSTR(ShipDate, -2) = '18')) as percentage;\nAmong the sales order shipped in July 2018, calculate the percentage of orders for home fragrances.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['ID', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n `Median Income` integer, -- example: [31061, 48775]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['ID', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n PRIMARY KEY (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames that start with alphabet \"W\" refer to Customer Names LIKE 'W%';\nList down the customer IDs and names that start with alphabet \"W\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT CustomerID, `Customer Names` FROM Customers WHERE `Customer Names` LIKE 'W%' ORDER BY `Customer Names` DESC",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT CustomerID, `Customer Names` FROM Customers WHERE `Customer Names` LIKE 'W%' ORDER BY `Customer Names` DESC",
"index": 1282,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['ID', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n `Median Income` integer, -- example: [31061, 48775]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['ID', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n PRIMARY KEY (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames that start with alphabet \"W\" refer to Customer Names LIKE 'W%';\nList down the customer IDs and names that start with alphabet \"W\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Allen County', 'Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['ID', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['ID', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nID refers to StoreID;\nDescribe the ID, city and region of the stores which are in Allen country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.StoreID, T2.`City Name`, T1.Region FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T2.County = 'Allen County'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT T2.StoreID, T2.`City Name`, T1.Region FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T2.County = 'Allen County'",
"index": 1283,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Allen County', 'Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['ID', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['ID', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nID refers to StoreID;\nDescribe the ID, city and region of the stores which are in Allen country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['ID', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['Borough', 'City', 'CDP', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Population integer, -- example: [212461, 190582]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['ID', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCOUNT(StoreID) < COUNT(StoreID where Type = 'Borough') < COUNT(StoreID where Type = 'CDP');\nList the ID, city, state and region for the store type which is fewer between borough and CDP.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.StoreID, T2.`City Name`, T1.State, T2.Type FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T2.Type = 'Borough' OR T2.Type = 'CDP'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT T2.StoreID, T2.`City Name`, T1.State, T2.Type FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T2.Type = 'Borough' OR T2.Type = 'CDP'",
"index": 1284,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['ID', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['Borough', 'City', 'CDP', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Population integer, -- example: [212461, 190582]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['ID', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCOUNT(StoreID) < COUNT(StoreID where Type = 'Borough') < COUNT(StoreID where Type = 'CDP');\nList the ID, city, state and region for the store type which is fewer between borough and CDP.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Medline ', 'Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n PRIMARY KEY (SalesTeamID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMedline is the name of the customer; DIVIDE(COUNT(OrderNumber where Sales Channel = 'In-Store' and Customer Names = 'Medline'), COUNT(OrderNumber where Customer Names = 'Medline')) as percentage;\nCalculate the percentage of order via in-store channel of customer \"Medline\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T1.`Sales Channel` = 'In-Store' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1._CustomerID) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T2.`Customer Names` = 'Medline '",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.`Sales Channel` = 'In-Store' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1._CustomerID) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T2.`Customer Names` = 'Medline '",
"index": 1285,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Medline ', 'Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n PRIMARY KEY (SalesTeamID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMedline is the name of the customer; DIVIDE(COUNT(OrderNumber where Sales Channel = 'In-Store' and Customer Names = 'Medline'), COUNT(OrderNumber where Customer Names = 'Medline')) as percentage;\nCalculate the percentage of order via in-store channel of customer \"Medline\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['California', 'Alabama', 'Arkansas']\n Latitude real, -- example: [33.52744, 34.69901]\n Population integer, -- example: [212461, 190582]\n `Water Area` integer, -- example: [6591013, 3452021]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Discount Applied` real, -- example: [0.075, 0.05]\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['California', 'Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncities refer to City Name; no water area refers to Water Area = 0;\nList the store located cities with regions in no water area of California state.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.`City Name` FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T2.State = 'California' AND T2.`Water Area` = '0'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT T2.`City Name` FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T2.State = 'California' AND T2.`Water Area` = '0'",
"index": 1286,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['California', 'Alabama', 'Arkansas']\n Latitude real, -- example: [33.52744, 34.69901]\n Population integer, -- example: [212461, 190582]\n `Water Area` integer, -- example: [6591013, 3452021]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Discount Applied` real, -- example: [0.075, 0.05]\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['California', 'Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncities refer to City Name; no water area refers to Water Area = 0;\nList the store located cities with regions in no water area of California state.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnet profit can be computed as SUBTRACT(Unit Price, Unit Cost); highest median income city refers to City Name where MAX(Median Income);\nCalculate the total net profit of the store located in highest median income city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID ORDER BY T2.`Median Income` DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID ORDER BY T2.`Median Income` DESC LIMIT 1",
"index": 1287,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnet profit can be computed as SUBTRACT(Unit Price, Unit Cost); highest median income city refers to City Name where MAX(Median Income);\nCalculate the total net profit of the store located in highest median income city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Discount Applied` real, -- example: [0.075, 0.05]\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['GA', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Population integer, -- example: [212461, 190582]\n `Median Income` integer, -- example: [31061, 48775]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['GA', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nState the full name of state code \"GA\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T FROM ( SELECT IIF(StateCode = 'GA', State, NULL) AS T FROM Regions ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T FROM ( SELECT IIF(StateCode = 'GA', State, NULL) AS T FROM Regions ) WHERE T IS NOT NULL",
"index": 1288,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Discount Applied` real, -- example: [0.075, 0.05]\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['GA', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Population integer, -- example: [212461, 190582]\n `Median Income` integer, -- example: [31061, 48775]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['GA', 'AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nState the full name of state code \"GA\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Midwest', 'Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['Midwest', 'South', 'West']\n PRIMARY KEY (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many states located in the Midwest region?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T) FROM ( SELECT CASE WHEN Region = 'Midwest' THEN StateCode ELSE NULL END AS T FROM Regions ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T) FROM ( SELECT CASE WHEN Region = 'Midwest' THEN StateCode ELSE NULL END AS T FROM Regions ) WHERE T IS NOT NULL",
"index": 1289,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Midwest', 'Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['Midwest', 'South', 'West']\n PRIMARY KEY (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many states located in the Midwest region?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\n Longitude real, -- example: [-86.79905, -86.67298]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList out the product name of order which has unit cost of 781.22.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T FROM ( SELECT DISTINCT IIF(T1.`Unit Cost` = 781.22, T2.`Product Name`, NULL) AS T FROM `Sales Orders` T1 INNER JOIN Products T2 ON T2.ProductID = T1._ProductID ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T FROM ( SELECT DISTINCT IIF(T1.`Unit Cost` = 781.22, T2.`Product Name`, NULL) AS T FROM `Sales Orders` T1 INNER JOIN Products T2 ON T2.ProductID = T1._ProductID ) WHERE T IS NOT NULL",
"index": 1290,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\n Longitude real, -- example: [-86.79905, -86.67298]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList out the product name of order which has unit cost of 781.22.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCookware is the name of the product;\nState the delivery date of cookware.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T FROM ( SELECT DISTINCT IIF(T2.`Product Name` = 'Cookware', T1.DeliveryDate, NULL) AS T FROM `Sales Orders` T1 INNER JOIN Products T2 ON T2.ProductID = T1._ProductID ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T FROM ( SELECT DISTINCT IIF(T2.`Product Name` = 'Cookware', T1.DeliveryDate, NULL) AS T FROM `Sales Orders` T1 INNER JOIN Products T2 ON T2.ProductID = T1._ProductID ) WHERE T IS NOT NULL",
"index": 1291,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCookware is the name of the product;\nState the delivery date of cookware.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\napplied 10% discount refers to Discount Applied = 0.1;\nList out the name of products which have been applied 10% discount.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T FROM ( SELECT DISTINCT IIF(T1.`Discount Applied` = 0.1, T2.`Product Name`, NULL) AS T FROM `Sales Orders` T1 INNER JOIN Products T2 ON T2.ProductID = T1._ProductID ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T FROM ( SELECT DISTINCT IIF(T1.`Discount Applied` = 0.1, T2.`Product Name`, NULL) AS T FROM `Sales Orders` T1 INNER JOIN Products T2 ON T2.ProductID = T1._ProductID ) WHERE T IS NOT NULL",
"index": 1292,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\napplied 10% discount refers to Discount Applied = 0.1;\nList out the name of products which have been applied 10% discount.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Ole Group', 'Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOle Group is the name of the customer; discount levels applied refer to Discount Applied NOT NULL;\nList out the discount levels applied for all orders from Ole Group.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T FROM ( SELECT DISTINCT CASE WHEN T1.`Customer Names` = 'Ole Group' THEN T2.`Discount Applied` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T FROM ( SELECT DISTINCT CASE WHEN T1.`Customer Names` = 'Ole Group' THEN T2.`Discount Applied` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL",
"index": 1293,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Ole Group', 'Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOle Group is the name of the customer; discount levels applied refer to Discount Applied NOT NULL;\nList out the discount levels applied for all orders from Ole Group.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Ei ', 'Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\n `Water Area` integer, -- example: [6591013, 3452021]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n PRIMARY KEY (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEi is the name of the customer; orders have quantity greater than 4 refer to OrderNumber WHERE Order Quantity > 4;\nAmong the orders placed by Ei, how many orders have quantity greater than 4?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN T1.`Order Quantity` > 4 AND T2.`Customer Names` = 'Ei ' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T1.`Order Quantity` > 4 AND T2.`Customer Names` = 'Ei ' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID",
"index": 1294,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Ei ', 'Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\n `Water Area` integer, -- example: [6591013, 3452021]\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n PRIMARY KEY (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEi is the name of the customer; orders have quantity greater than 4 refer to OrderNumber WHERE Order Quantity > 4;\nAmong the orders placed by Ei, how many orders have quantity greater than 4?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nunit cost greater than 4000USD refers to Unit Cost > 4000;\nWhat is the customer names of orders which have unit cost greater than 4000USD?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.`Unit Cost` > 4000 THEN T1.`Customer Names` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.`Unit Cost` > 4000 THEN T1.`Customer Names` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL",
"index": 1295,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nunit cost greater than 4000USD refers to Unit Cost > 4000;\nWhat is the customer names of orders which have unit cost greater than 4000USD?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncity has the largest population refers to City Name where MAX(Population);\nWhich city has the largest population?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT `City Name` FROM `Store Locations` ORDER BY Population DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT `City Name` FROM `Store Locations` ORDER BY Population DESC LIMIT 1",
"index": 1296,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncity has the largest population refers to City Name where MAX(Population);\nWhich city has the largest population?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAVG(Unit Price where Product Name = 'Cookware');\nWhat is the average unit price of a Cookware product?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(REPLACE(T1.`Unit Price`, ',', '')) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T2.`Product Name` = 'Cookware'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT AVG(REPLACE(T1.`Unit Price`, ',', '')) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T2.`Product Name` = 'Cookware'",
"index": 1297,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Median Income` integer, -- example: [31061, 48775]\n `Land Area` integer, -- example: [378353942, 552604579]\n `Water Area` integer, -- example: [6591013, 3452021]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['6/19/18', '7/2/18']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAVG(Unit Price where Product Name = 'Cookware');\nWhat is the average unit price of a Cookware product?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n OrderDate text, -- example: ['5/31/20', '5/31/18', '5/31/19', '6/1/18']\n ShipDate text, -- example: ['5/31/20', '5/31/19', '6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['5/31/20', '7/31/18', '5/31/19', '6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhad orders on 5/31/2018 refer to OrderDate = '5/31/18'; sale team names refer to Sales Team;\nPlease list all sale team names which had orders on 5/31/2018.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T FROM ( SELECT DISTINCT CASE WHEN T1.OrderDate = '5/31/18' THEN T2.`Sales Team` ELSE NULL END AS T FROM `Sales Orders` T1 INNER JOIN `Sales Team` T2 ON T2.SalesTeamID = T1._SalesTeamID ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T FROM ( SELECT DISTINCT CASE WHEN T1.OrderDate = '5/31/18' THEN T2.`Sales Team` ELSE NULL END AS T FROM `Sales Orders` T1 INNER JOIN `Sales Team` T2 ON T2.SalesTeamID = T1._SalesTeamID ) WHERE T IS NOT NULL",
"index": 1298,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n OrderDate text, -- example: ['5/31/20', '5/31/18', '5/31/19', '6/1/18']\n ShipDate text, -- example: ['5/31/20', '5/31/19', '6/14/18', '6/22/18']\n DeliveryDate text, -- example: ['5/31/20', '7/31/18', '5/31/19', '6/19/18', '7/2/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Price` text, -- example: ['1,963.10', '3,939.60']\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhad orders on 5/31/2018 refer to OrderDate = '5/31/18'; sale team names refer to Sales Team;\nPlease list all sale team names which had orders on 5/31/2018.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n `Median Income` integer, -- example: [31061, 48775]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsale team names refer to Sales Team; the least orders in 2019 refer to MIN(COUNT(OrderNumber where SUBSTR(OrderDate, -2) = '19'));\nWhich sales team name has the least orders in 2019?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.OrderDate LIKE '%/%/19' GROUP BY T2.`Sales Team` ORDER BY COUNT(T1.OrderNumber) ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.OrderDate LIKE '%/%/19' GROUP BY T2.`Sales Team` ORDER BY COUNT(T1.OrderNumber) ASC LIMIT 1",
"index": 1299,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/18']\n OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/18']\n CurrencyCode text, -- example: ['USD']\n _SalesTeamID integer, -- example: [6, 14]\n _CustomerID integer, -- example: [15, 20]\n _StoreID integer, -- example: [259, 196]\n _ProductID integer, -- example: [12, 27]\n `Order Quantity` integer, -- example: [5, 3]\n `Discount Applied` real, -- example: [0.075, 0.05]\n `Unit Cost` text, -- example: ['1,001.18', '3,348.66']\n PRIMARY KEY (OrderNumber),\n CONSTRAINT fk_sales_orders__salesteamid FOREIGN KEY (_SalesTeamID) REFERENCES `Sales Team` (SalesTeamID),\n CONSTRAINT fk_sales_orders__customerid FOREIGN KEY (_CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_orders__storeid FOREIGN KEY (_StoreID) REFERENCES `Store Locations` (StoreID),\n CONSTRAINT fk_sales_orders__productid FOREIGN KEY (_ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n `Median Income` integer, -- example: [31061, 48775]\n `Time Zone` text, -- example: ['America/Chicago', 'America/Phoenix']\n PRIMARY KEY (StoreID),\n CONSTRAINT fk_store_locations_statecode FOREIGN KEY (StateCode) REFERENCES Regions (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsale team names refer to Sales Team; the least orders in 2019 refer to MIN(COUNT(OrderNumber where SUBSTR(OrderDate, -2) = '19'));\nWhich sales team name has the least orders in 2019?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.