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 Products (\n ProductID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['George Lewis', 'Adam Hernandez', 'Keith Griffin']\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 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 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 `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\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 `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:\nGeorge Lewis refers to Sales Team; the highest number of orders refers to MAX(COUNT(OrderNumber)); which year from 2018 to 2020 refers to SUBSTR(OrderDate, -2) IN ('18', '19', '20') GROUP BY SUBSTR(OrderDate, -2);\nFrom 2018 to 2020, which year did the George Lewis group have the highest number of orders?\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 SUBSTR(T1.OrderDate, -2, 2) FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.`Sales Team` = 'George Lewis' GROUP BY SUBSTR(T1.OrderDate, -2, 2) ORDER BY COUNT(T1.OrderNumber) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT SUBSTR(T1.OrderDate, -2, 2) FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.`Sales Team` = 'George Lewis' GROUP BY SUBSTR(T1.OrderDate, -2, 2) ORDER BY COUNT(T1.OrderNumber) DESC LIMIT 1",
"index": 1300,
"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 PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['George Lewis', 'Adam Hernandez', 'Keith Griffin']\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 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 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 `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\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 `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:\nGeorge Lewis refers to Sales Team; the highest number of orders refers to MAX(COUNT(OrderNumber)); which year from 2018 to 2020 refers to SUBSTR(OrderDate, -2) IN ('18', '19', '20') GROUP BY SUBSTR(OrderDate, -2);\nFrom 2018 to 2020, which year did the George Lewis group have the highest number of orders?\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 _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 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 `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 `Store Locations` (\n StoreID integer, -- example: [1, 2]\n County text, -- example: ['Orange County', '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 `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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(OrderNumber where County = 'Orange County' and SUBSTR(OrderDate, -2) = '18'), COUNT(OrderNumber where SUBSTR(OrderDate, -2) = '18')) as percentage;\nWhat is the percentage of total orders from stores in Orange County in 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 CAST(SUM(CASE WHEN T2.County = 'Orange County' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.OrderDate LIKE '%/%/18'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.County = 'Orange County' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.OrderDate LIKE '%/%/18'",
"index": 1301,
"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 _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 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 `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 `Store Locations` (\n StoreID integer, -- example: [1, 2]\n County text, -- example: ['Orange County', '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 `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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(OrderNumber where County = 'Orange County' and SUBSTR(OrderDate, -2) = '18'), COUNT(OrderNumber where SUBSTR(OrderDate, -2) = '18')) as percentage;\nWhat is the percentage of total orders from stores in Orange County in 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 `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 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 `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 Products (\n ProductID integer, -- example: [1, 2]\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 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: ['ID', '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 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:\nthe highest number of orders in 2018 refers to MAX(COUNT(OrderNumber where SUBSTR(OrderDate, -2) = '18'));\nWhich sales team id has the highest number of orders in 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 _SalesTeamID FROM `Sales Orders` WHERE OrderDate LIKE '%/%/18' GROUP BY _SalesTeamID ORDER BY COUNT(_SalesTeamID) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT _SalesTeamID FROM `Sales Orders` WHERE OrderDate LIKE '%/%/18' GROUP BY _SalesTeamID ORDER BY COUNT(_SalesTeamID) DESC LIMIT 1",
"index": 1302,
"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 County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['ID', '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 Population integer, -- example: [212461, 190582]\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 Products (\n ProductID integer, -- example: [1, 2]\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 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: ['ID', '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 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:\nthe highest number of orders in 2018 refers to MAX(COUNT(OrderNumber where SUBSTR(OrderDate, -2) = '18'));\nWhich sales team id has the highest number of orders in 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 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 `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 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 `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 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:\nratio can be calculated as DIVIDE(MAX(Unit_Cost)), MIN(Unit Cost);\nCalculate ratio between the highest unit cost and the lowest unit cost?\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 ( SELECT REPLACE(`Unit Cost`, ',', '') FROM `Sales Orders` WHERE REPLACE(`Unit Cost`, ',', '') = ( SELECT REPLACE(`Unit Cost`, ',', '') FROM `Sales Orders` ORDER BY REPLACE(`Unit Cost`, ',', '') DESC LIMIT 1 ) ORDER BY REPLACE(`Unit Cost`, ',', '') DESC LIMIT 1 ) / ( SELECT REPLACE(`Unit Cost`, ',', '') FROM `Sales Orders` WHERE REPLACE(`Unit Cost`, ',', '') = ( SELECT REPLACE(`Unit Cost`, ',', '') FROM `Sales Orders` ORDER BY REPLACE(`Unit Cost`, ',', '') ASC LIMIT 1 ) ORDER BY REPLACE(`Unit Cost`, ',', '') ASC LIMIT 1 )",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT ( SELECT REPLACE(`Unit Cost`, ',', '') FROM `Sales Orders` WHERE REPLACE(`Unit Cost`, ',', '') = ( SELECT REPLACE(`Unit Cost`, ',', '') FROM `Sales Orders` ORDER BY REPLACE(`Unit Cost`, ',', '') DESC LIMIT 1 ) ORDER BY REPLACE(`Unit Cost`, ',', '') DESC LIMIT 1 ) / ( SELECT REPLACE(`Unit Cost`, ',', '') FROM `Sales Orders` WHERE REPLACE(`Unit Cost`, ',', '') = ( SELECT REPLACE(`Unit Cost`, ',', '') FROM `Sales Orders` ORDER BY REPLACE(`Unit Cost`, ',', '') ASC LIMIT 1 ) ORDER BY REPLACE(`Unit Cost`, ',', '') ASC LIMIT 1 )",
"index": 1303,
"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: ['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 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 `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 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:\nratio can be calculated as DIVIDE(MAX(Unit_Cost)), MIN(Unit Cost);\nCalculate ratio between the highest unit cost and the lowest unit cost?\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 Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\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 Latitude real, -- example: [33.52744, 34.69901]\n AreaCode integer, -- example: [205, 256]\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: ['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 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 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:\nproduct refers to Product Name; ordered the most in 2018 refers to MAX(COUNT(OrderNumber)) where SUBSTR(OrderDate, -2) = '18';\nWhich product was ordered the most in 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 T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T1.OrderDate LIKE '%/%/18' GROUP BY T1._ProductID ORDER BY COUNT(T1._ProductID) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T1.OrderDate LIKE '%/%/18' GROUP BY T1._ProductID ORDER BY COUNT(T1._ProductID) DESC LIMIT 1",
"index": 1304,
"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 Region text, -- example: ['Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\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 Latitude real, -- example: [33.52744, 34.69901]\n AreaCode integer, -- example: [205, 256]\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: ['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 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 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:\nproduct refers to Product Name; ordered the most in 2018 refers to MAX(COUNT(OrderNumber)) where SUBSTR(OrderDate, -2) = '18';\nWhich product was ordered the most in 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 ProcuredDate text, -- example: ['12/31/17', '4/10/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 `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 PRIMARY KEY (ProductID)\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 County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproducts sold by Adam Hernandez refer to SUM(Order Quantity where Sales Team = 'Adam Hernandez');\nHow many products sold by Adam Hernandez?\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.`Sales Team` = 'Adam Hernandez' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.`Sales Team` = 'Adam Hernandez' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID",
"index": 1305,
"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 ProcuredDate text, -- example: ['12/31/17', '4/10/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 `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 PRIMARY KEY (ProductID)\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 County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\n Latitude real, -- example: [33.52744, 34.69901]\n Longitude real, -- example: [-86.79905, -86.67298]\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproducts sold by Adam Hernandez refer to SUM(Order Quantity where Sales Team = 'Adam Hernandez');\nHow many products sold by Adam Hernandez?\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 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 `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 Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Qualitest ', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nQualitest ordered the highest product quantity refers to Customer Names where MAX(Order Quantity);\nState the order number where Qualitest ordered the highest product quantity.\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 FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T2.`Customer Names` = 'Qualitest ' ORDER BY T1.`Order Quantity` DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T1.OrderNumber FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T2.`Customer Names` = 'Qualitest ' ORDER BY T1.`Order Quantity` DESC LIMIT 1",
"index": 1306,
"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 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 `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 Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Qualitest ', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nQualitest ordered the highest product quantity refers to Customer Names where MAX(Order Quantity);\nState the order number where Qualitest ordered the highest product quantity.\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 PRIMARY KEY (CustomerID)\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 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 `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 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 _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);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\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:\norders for all in-store sales refer to OrderNumber where Sales Channel = 'In-Store'; products refer to Product Name;\nList the order for all in-store sales along with the products sold.\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.OrderNumber, T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T1.`Sales Channel` = 'In-Store'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT T1.OrderNumber, T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T1.`Sales Channel` = 'In-Store'",
"index": 1307,
"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 PRIMARY KEY (CustomerID)\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 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 `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 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 _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);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\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:\norders for all in-store sales refer to OrderNumber where Sales Channel = 'In-Store'; products refer to Product Name;\nList the order for all in-store sales along with the products sold.\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 Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\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 _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 County text, -- example: ['Maricopa County', 'Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe least sold product refers to Product Name where MIN(Order Quantity);\nAmong the products sold in Maricopa County, which was the least sold?\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.`Product Name` FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID WHERE T3.County = 'Maricopa County' ORDER BY T2.`Order Quantity` ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T1.`Product Name` FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID WHERE T3.County = 'Maricopa County' ORDER BY T2.`Order Quantity` ASC LIMIT 1",
"index": 1308,
"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 Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\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 _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 County text, -- example: ['Maricopa County', 'Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['AL', 'AR']\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe least sold product refers to Product Name where MIN(Order Quantity);\nAmong the products sold in Maricopa County, which was the least sold?\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 Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Baseball', 'Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\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 OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/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 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 PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n Longitude real, -- example: [-86.79905, -86.67298]\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:\nProduct Name = 'Baseball'; December 2017 refers to OrderDate LIKE '12/%/17';\nFind the number of baseball ordered in December 2017.\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.OrderNumber) FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID WHERE T1.`Product Name` = 'Baseball' AND T2.OrderDate LIKE '12/%/18'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT COUNT(T2.OrderNumber) FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID WHERE T1.`Product Name` = 'Baseball' AND T2.OrderDate LIKE '12/%/18'",
"index": 1309,
"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 Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Baseball', 'Cookware', 'Photo Frames']\n PRIMARY KEY (ProductID)\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 OrderDate text, -- example: ['5/31/18', '6/1/18']\n ShipDate text, -- example: ['6/14/18', '6/22/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 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 PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n Longitude real, -- example: [-86.79905, -86.67298]\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:\nProduct Name = 'Baseball'; December 2017 refers to OrderDate LIKE '12/%/17';\nFind the number of baseball ordered in December 2017.\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: ['ID', 'AL', 'AR']\n State text, -- example: ['Michigan', '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);\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 `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 _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 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 County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['ID', 'AL', 'AR']\n State text, -- example: ['Michigan', 'Alabama', 'Arkansas']\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Michigan\" is the State\nWrite down the store IDs and region of the state \"Michigan\".\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, T1.Region FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T2.State = 'Michigan'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT T2.StoreID, T1.Region FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T2.State = 'Michigan'",
"index": 1310,
"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: ['ID', 'AL', 'AR']\n State text, -- example: ['Michigan', '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);\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 `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 _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 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 County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['ID', 'AL', 'AR']\n State text, -- example: ['Michigan', 'Alabama', 'Arkansas']\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Michigan\" is the State\nWrite down the store IDs and region of the state \"Michigan\".\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 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 PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Pacific Ltd', 'Apollo Ltd', 'Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\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 `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 `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Apollo Ltd\" and \"Pacific Ltd\" are both Customer Names; total number of orders refers to COUNT(OrderNumber)\nCompare the total number of orders between customer \"Apollo Ltd\" and \"Pacific Ltd\".\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.`Customer Names` = 'Apollo Ltd' THEN 1 ELSE 0 END), SUM(CASE WHEN T2.`Customer Names` = 'Pacific Ltd' 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 T2.`Customer Names` = 'Apollo Ltd' THEN 1 ELSE 0 END), SUM(CASE WHEN T2.`Customer Names` = 'Pacific Ltd' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID",
"index": 1311,
"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 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 PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Pacific Ltd', 'Apollo Ltd', 'Avon Corp', 'WakeFern ']\n PRIMARY KEY (CustomerID)\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 `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 `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Apollo Ltd\" and \"Pacific Ltd\" are both Customer Names; total number of orders refers to COUNT(OrderNumber)\nCompare the total number of orders between customer \"Apollo Ltd\" and \"Pacific Ltd\".\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: ['ID', 'AL', 'AR']\n Population integer, -- example: [212461, 190582]\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 Products (\n ProductID integer, -- example: [1, 2]\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);\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 PRIMARY KEY (SalesTeamID)\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 _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:\nIDs refers to CustomerID; total net profit of above 5000 USD refers to SUM(Subtract(Unit Price, Unit Cost)) > 5000\nMention the customer names and IDs which ordered total net profit of above 5000 USD through online channel.\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 `Customer Names`, CustomerID FROM ( SELECT T2.`Customer Names`, T2.CustomerID , SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) AS T FROM `Sales Orders` T1 INNER JOIN Customers T2 ON T2.CustomerID = T1._CustomerID WHERE T1.`Sales Channel` = 'Online' GROUP BY T2.CustomerID ) WHERE T > 5000",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT `Customer Names`, CustomerID FROM ( SELECT T2.`Customer Names`, T2.CustomerID , SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) AS T FROM `Sales Orders` T1 INNER JOIN Customers T2 ON T2.CustomerID = T1._CustomerID WHERE T1.`Sales Channel` = 'Online' GROUP BY T2.CustomerID ) WHERE T > 5000",
"index": 1312,
"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: ['ID', 'AL', 'AR']\n Population integer, -- example: [212461, 190582]\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 Products (\n ProductID integer, -- example: [1, 2]\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);\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 PRIMARY KEY (SalesTeamID)\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 _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:\nIDs refers to CustomerID; total net profit of above 5000 USD refers to SUM(Subtract(Unit Price, Unit Cost)) > 5000\nMention the customer names and IDs which ordered total net profit of above 5000 USD through online channel.\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 PRIMARY KEY (SalesTeamID)\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 _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 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 `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['ID', 'AL', 'AR']\n AreaCode integer, -- example: [205, 256]\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: ['ID', 'AL', 'AR']\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 is 11 refers to _CustomerID = 11;\nIndicate the procured dates for the customer whose ID is 11.\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 T FROM ( SELECT IIF(_CustomerID = 11, ProcuredDate, NULL) AS T FROM `Sales Orders` ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT T FROM ( SELECT IIF(_CustomerID = 11, ProcuredDate, NULL) AS T FROM `Sales Orders` ) WHERE T IS NOT NULL",
"index": 1313,
"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 PRIMARY KEY (SalesTeamID)\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 _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 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 `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['ID', 'AL', 'AR']\n AreaCode integer, -- example: [205, 256]\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: ['ID', 'AL', 'AR']\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 is 11 refers to _CustomerID = 11;\nIndicate the procured dates for the customer whose ID is 11.\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 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 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: ['Distributor', '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 `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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Distributor\" is the Sales Channel; minimum quantity refers to Min(Order Quantity)\nHow many orders through distributor were for the minimum quantity?\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 `Order Quantity` = 1 AND `Sales Channel` = 'Distributor' THEN 1 ELSE 0 END) FROM `Sales Orders`",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN `Order Quantity` = 1 AND `Sales Channel` = 'Distributor' THEN 1 ELSE 0 END) FROM `Sales Orders`",
"index": 1314,
"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 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 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: ['Distributor', '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 `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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Distributor\" is the Sales Channel; minimum quantity refers to Min(Order Quantity)\nHow many orders through distributor were for the minimum quantity?\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 `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\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 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 County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['ID', 'AL', 'AR']\n AreaCode integer, -- example: [205, 256]\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 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);\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:\nID refers to _SalesTeamID; 10% discount refers to Discount Applied = 0.1; 'In-Store' is the Sales Channel\nList by ID all sales teams that have sold products at a 10% discount in 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 DISTINCT T FROM ( SELECT CASE WHEN `Discount Applied` = '0.1' AND `Sales Channel` = 'In-Store' THEN _SalesTeamID ELSE NULL END AS T FROM `Sales Orders` ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT T FROM ( SELECT CASE WHEN `Discount Applied` = '0.1' AND `Sales Channel` = 'In-Store' THEN _SalesTeamID ELSE NULL END AS T FROM `Sales Orders` ) WHERE T IS NOT NULL",
"index": 1315,
"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 `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['In-Store', 'Online']\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 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 County text, -- example: ['Shelby County/Jefferson County', 'Limestone County/Madison County']\n StateCode text, -- example: ['ID', 'AL', 'AR']\n AreaCode integer, -- example: [205, 256]\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 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);\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:\nID refers to _SalesTeamID; 10% discount refers to Discount Applied = 0.1; 'In-Store' is the Sales Channel\nList by ID all sales teams that have sold products at a 10% discount in 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 `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Brooklyn', '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: ['Borough', 'City', 'Town']\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 Team` (\n SalesTeamID integer, -- example: [1, 2]\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Brooklyn\" is the CityName; population of less than 3 million refers to Population < 3000000\nHow many Borough-type stores located in the city of Brooklyn have a population of less than 3 million?\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 Population < 3000000 AND Type = 'Borough' AND `City Name` = 'Brooklyn' THEN 1 ELSE 0 END) FROM `Store Locations`",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN Population < 3000000 AND Type = 'Borough' AND `City Name` = 'Brooklyn' THEN 1 ELSE 0 END) FROM `Store Locations`",
"index": 1316,
"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: ['Brooklyn', '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: ['Borough', 'City', 'Town']\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 Team` (\n SalesTeamID integer, -- example: [1, 2]\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Brooklyn\" is the CityName; population of less than 3 million refers to Population < 3000000\nHow many Borough-type stores located in the city of Brooklyn have a population of less than 3 million?\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 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 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 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 `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 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);\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: ['Midwest', '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:\nHow many states are 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 State 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 State ELSE NULL END AS T FROM Regions ) WHERE T IS NOT NULL",
"index": 1317,
"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 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 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 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 `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 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);\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: ['Midwest', '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:\nHow many states are 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 `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 `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 AreaCode integer, -- example: [205, 256]\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 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 `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 PRIMARY KEY (SalesTeamID)\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:\nproducts refers to Product Name; highest net profit = Max(Subtract(Unit Price, Unit Cost))\nWhat are the top 10 products with the highest net profit?\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.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID GROUP BY T1._ProductID ORDER BY SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) DESC LIMIT 10",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID GROUP BY T1._ProductID ORDER BY SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) DESC LIMIT 10",
"index": 1318,
"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 `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 AreaCode integer, -- example: [205, 256]\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 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 `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 PRIMARY KEY (SalesTeamID)\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:\nproducts refers to Product Name; highest net profit = Max(Subtract(Unit Price, Unit Cost))\nWhat are the top 10 products with the highest net profit?\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 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 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 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 `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 PRIMARY KEY (ProductID)\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 Type text, -- example: ['City', 'Town']\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of customer refers to Customer Names; order of 3 unit refers to Order Quantity = 3; in February 2018 refers to OrderDate LIKE '2/%/18'\nIndicate the name of the customers who have placed an order of 3 units in February 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 T2.`Order Quantity` = 3 AND T2.OrderDate LIKE '2/%/18' 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.`Order Quantity` = 3 AND T2.OrderDate LIKE '2/%/18' 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": 1319,
"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 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 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 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 `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 PRIMARY KEY (ProductID)\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 Type text, -- example: ['City', 'Town']\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of customer refers to Customer Names; order of 3 unit refers to Order Quantity = 3; in February 2018 refers to OrderDate LIKE '2/%/18'\nIndicate the name of the customers who have placed an order of 3 units in February 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 `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 Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\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 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 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 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 Products (\n ProductID integer, -- example: [1, 2]\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"WARE-UHY1004\" is the WarehouseCode\nIn which regions are the stores that have shipped products through the WARE-UHY1004 warehouse?\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 T3.WarehouseCode = 'WARE-UHY1004' THEN T1.Region END AS T FROM Regions T1 INNER JOIN `Store Locations` T2 ON T2.StateCode = T1.StateCode INNER JOIN `Sales Orders` T3 ON T3._StoreID = T2.StoreID ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T FROM ( SELECT DISTINCT CASE WHEN T3.WarehouseCode = 'WARE-UHY1004' THEN T1.Region END AS T FROM Regions T1 INNER JOIN `Store Locations` T2 ON T2.StateCode = T1.StateCode INNER JOIN `Sales Orders` T3 ON T3._StoreID = T2.StoreID ) WHERE T IS NOT NULL",
"index": 1320,
"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 Population integer, -- example: [212461, 190582]\n `Household Income` integer, -- example: [89972, 78554]\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 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 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 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 Products (\n ProductID integer, -- example: [1, 2]\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"WARE-UHY1004\" is the WarehouseCode\nIn which regions are the stores that have shipped products through the WARE-UHY1004 warehouse?\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: ['11/21/19', '10/21/18', '11/21/18', '10/21/19', '5/31/18', '6/1/18']\n DeliveryDate text, -- example: ['11/21/19', '10/21/18', '11/21/18', '10/21/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 `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 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 Type text, -- example: ['City', 'Town']\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 `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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nordered on 10/21/18 refers to OrderDate = '10/21/18'; delivered on 11/21/19 refers to DeliveryDate = '11/21/19'; name of product refers to Product Name\nLists the name of the product and customer who placed an order on 10/21/18 and it was delivered on 11/21/19.\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 T3.`Product Name`, 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 T2.OrderDate = '10/21/18' AND T2.DeliveryDate = '11/21/19'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T3.`Product Name`, 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 T2.OrderDate = '10/21/18' AND T2.DeliveryDate = '11/21/19'",
"index": 1321,
"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: ['11/21/19', '10/21/18', '11/21/18', '10/21/19', '5/31/18', '6/1/18']\n DeliveryDate text, -- example: ['11/21/19', '10/21/18', '11/21/18', '10/21/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 `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 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 Type text, -- example: ['City', 'Town']\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 `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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nordered on 10/21/18 refers to OrderDate = '10/21/18'; delivered on 11/21/19 refers to DeliveryDate = '11/21/19'; name of product refers to Product Name\nLists the name of the product and customer who placed an order on 10/21/18 and it was delivered on 11/21/19.\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: ['Oregon', 'Alabama', 'Arkansas']\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 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 State text, -- example: ['Oregon', 'Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n AreaCode integer, -- example: [205, 256]\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 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 `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['10/27/18', '12/31/17', '4/10/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:\nOctober 27, 2018 refers to ProcuredDate = '10/27/18'; 'Oregon' is the State\nHow many stores procured products on October 27, 2018, in the city of Oregon?\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.ProcuredDate = '10/27/18' AND T2.`City Name` = 'Orlando' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T1.ProcuredDate = '10/27/18' AND T2.`City Name` = 'Orlando' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID",
"index": 1322,
"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: ['Oregon', 'Alabama', 'Arkansas']\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 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 State text, -- example: ['Oregon', 'Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n AreaCode integer, -- example: [205, 256]\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 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 `Sales Channel` text, -- example: ['In-Store', 'Online']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['10/27/18', '12/31/17', '4/10/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:\nOctober 27, 2018 refers to ProcuredDate = '10/27/18'; 'Oregon' is the State\nHow many stores procured products on October 27, 2018, in the city of Oregon?\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 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 _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 `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\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 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 `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\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:\nhighest median income refers to Max(Median Income)\nWhat sales channels are used the most in the 3 places with the highest median income?\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 `Sales Channel` FROM ( SELECT T1.`Sales Channel` FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID ORDER BY T2.`Median Income` DESC LIMIT 3 ) GROUP BY `Sales Channel` ORDER BY COUNT(`Sales Channel`) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT `Sales Channel` FROM ( SELECT T1.`Sales Channel` FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID ORDER BY T2.`Median Income` DESC LIMIT 3 ) GROUP BY `Sales Channel` ORDER BY COUNT(`Sales Channel`) DESC LIMIT 1",
"index": 1323,
"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 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 _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 `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\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 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 `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\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:\nhighest median income refers to Max(Median Income)\nWhat sales channels are used the most in the 3 places with the highest median income?\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 `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 Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['Northeast', '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 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:\nHow many different time zones are there in the Northeast 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 T2.`Time Zone`) FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T1.Region = 'Northeast'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T2.`Time Zone`) FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T1.Region = 'Northeast'",
"index": 1324,
"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 `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 Regions (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['Northeast', '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 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:\nHow many different time zones are there in the Northeast 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 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 `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['South', 'Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\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 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 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 `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 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 `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:\nin the South refers to Region = 'South'; type of store that is most popular refers to Max(Count(Type))\nWhat type of store is most popular in the South?\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 CASE WHEN MAX(T2.Population) THEN T2.Type END FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT CASE WHEN MAX(T2.Population) THEN T2.Type END FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode",
"index": 1325,
"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 Team` (\n SalesTeamID integer, -- example: [1, 2]\n `Sales Team` text, -- example: ['Adam Hernandez', 'Keith Griffin']\n Region text, -- example: ['South', 'Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\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 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 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 `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 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 `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:\nin the South refers to Region = 'South'; type of store that is most popular refers to Max(Count(Type))\nWhat type of store is most popular in the South?\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: ['Online', 'In-Store']\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: ['AL', 'AR']\n Region text, -- example: ['South', 'West']\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 Type text, -- example: ['City', 'Town']\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n `Household Income` integer, -- example: [89972, 78554]\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 Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Ole Group', '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:\n\"Ole Group\" is the Customer Names; online purchase refers to Sales Channel = 'Online'; made in May 2019 refers to OrderDate LIKE '5/%/19'\nHow many online purchases did Ole Group make in May 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 SUM(CASE WHEN T1.`Sales Channel` = 'Online' AND T2.`Customer Names` = 'Ole Group' AND T1.OrderDate LIKE '5/%/19' 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.`Sales Channel` = 'Online' AND T2.`Customer Names` = 'Ole Group' AND T1.OrderDate LIKE '5/%/19' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID",
"index": 1326,
"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: ['Online', 'In-Store']\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: ['AL', 'AR']\n Region text, -- example: ['South', 'West']\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 Type text, -- example: ['City', 'Town']\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\n `Household Income` integer, -- example: [89972, 78554]\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 Customers (\n CustomerID integer, -- example: [1, 2]\n `Customer Names` text, -- example: ['Ole Group', '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:\n\"Ole Group\" is the Customer Names; online purchase refers to Sales Channel = 'Online'; made in May 2019 refers to OrderDate LIKE '5/%/19'\nHow many online purchases did Ole Group make in May 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"
} |
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 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 _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 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: ['Santa Clarita', 'Santa Clara', 'Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\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 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:\nleast purchased product refers to Min(Count(Product Name)); 'Santa Clarita' is the City\nWhat is the least purchased product by stores in the city of Santa Clarita?\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.`Product Name` FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID WHERE T3.`City Name` = 'Santa Clarita' GROUP BY T1.`Product Name` ORDER BY COUNT(T1.`Product Name`) ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T1.`Product Name` FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID WHERE T3.`City Name` = 'Santa Clarita' GROUP BY T1.`Product Name` ORDER BY COUNT(T1.`Product Name`) ASC LIMIT 1",
"index": 1327,
"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 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 _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 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: ['Santa Clarita', 'Santa Clara', 'Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\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 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:\nleast purchased product refers to Min(Count(Product Name)); 'Santa Clarita' is the City\nWhat is the least purchased product by stores in the city of Santa Clarita?\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 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 `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 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-PUJ1005', 'WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/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 `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:\nWARE-PUJ1005 is the WarehouseCode; fewest times refers to Min (Count(WarehouseCode))\nAt what Latitude and Longitude is the store that has used the WARE-PUJ1005 warehouse the fewest times?\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.Latitude, T2.Longitude FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.WarehouseCode = 'WARE-PUJ1005' GROUP BY T2.StoreID ORDER BY COUNT(T1.WarehouseCode) ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T2.Latitude, T2.Longitude FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.WarehouseCode = 'WARE-PUJ1005' GROUP BY T2.StoreID ORDER BY COUNT(T1.WarehouseCode) ASC LIMIT 1",
"index": 1328,
"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 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 `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 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-PUJ1005', 'WARE-UHY1004', 'WARE-NMK1003']\n ProcuredDate text, -- example: ['12/31/17', '4/10/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 `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:\nWARE-PUJ1005 is the WarehouseCode; fewest times refers to Min (Count(WarehouseCode))\nAt what Latitude and Longitude is the store that has used the WARE-PUJ1005 warehouse the fewest times?\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 `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n OrderDate text, -- example: ['1/1/20', '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 `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 State text, -- example: ['Alabama', 'Arkansas']\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 Products (\n ProductID integer, -- example: [1, 2]\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 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:\norder date after 1/1/2018 refers to OrderDate > '1/1/2018'\nIndicate order numbers with an order date after 1/1/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 DISTINCT T FROM ( SELECT CASE WHEN OrderDate > '1/1/18' THEN OrderNumber ELSE NULL END AS T FROM `Sales Orders` ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT T FROM ( SELECT CASE WHEN OrderDate > '1/1/18' THEN OrderNumber ELSE NULL END AS T FROM `Sales Orders` ) WHERE T IS NOT NULL",
"index": 1329,
"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 `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n OrderDate text, -- example: ['1/1/20', '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 `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 State text, -- example: ['Alabama', 'Arkansas']\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 Products (\n ProductID integer, -- example: [1, 2]\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 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:\norder date after 1/1/2018 refers to OrderDate > '1/1/2018'\nIndicate order numbers with an order date after 1/1/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 Team` (\n SalesTeamID integer, -- example: [1, 2]\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\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: ['Apollo Ltd', '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 _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: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\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:\n\"Apollo Ltd\" is the Customer Names; most expensive unit price refers to max(Unit Price)\nWhich Apollo Ltd customer's order number has the most expensive unit price, indicating the order date?\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, T1.OrderDate FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T2.`Customer Names` = 'Apollo Ltd' ORDER BY T1.`Unit Price` DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T1.OrderNumber, T1.OrderDate FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T2.`Customer Names` = 'Apollo Ltd' ORDER BY T1.`Unit Price` DESC LIMIT 1",
"index": 1330,
"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 PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\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: ['Apollo Ltd', '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 _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: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\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:\n\"Apollo Ltd\" is the Customer Names; most expensive unit price refers to max(Unit Price)\nWhich Apollo Ltd customer's order number has the most expensive unit price, indicating the order date?\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: ['Elorac, Corp', 'Avon Corp', 'WakeFern ']\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 `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\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 Products (\n ProductID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n Longitude real, -- example: [-86.79905, -86.67298]\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:\n\"Elorac, Corp\" is the Customer Names\nProvide order number, warehouse code of customers Elorac, Corp.\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.OrderNumber, T1.WarehouseCode FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T2.`Customer Names` = 'Elorac, Corp'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT T1.OrderNumber, T1.WarehouseCode FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T2.`Customer Names` = 'Elorac, Corp'",
"index": 1331,
"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: ['Elorac, Corp', 'Avon Corp', 'WakeFern ']\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 `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\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 Products (\n ProductID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n Longitude real, -- example: [-86.79905, -86.67298]\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:\n\"Elorac, Corp\" is the Customer Names\nProvide order number, warehouse code of customers Elorac, Corp.\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 Longitude real, -- example: [-86.79905, -86.67298]\n `Household Income` integer, -- example: [89972, 78554]\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: ['Cocktail Glasses', '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 PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['Online', 'In-Store']\n ProcuredDate text, -- example: ['12/31/17', '4/10/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 `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 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:\n\"Cocktail Glasses\" is the Product Name; customer refers to Customer Names\nName of customers who have ordered Cocktail Glasses by online sales channel.\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 T3.`Product Name` = 'Cocktail Glasses' AND T2.`Sales Channel` = 'Online' THEN T1.`Customer Names` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products T3 ON T3.ProductID = T2._ProductID ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T FROM ( SELECT DISTINCT CASE WHEN T3.`Product Name` = 'Cocktail Glasses' AND T2.`Sales Channel` = 'Online' THEN T1.`Customer Names` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products T3 ON T3.ProductID = T2._ProductID ) WHERE T IS NOT NULL",
"index": 1332,
"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 Longitude real, -- example: [-86.79905, -86.67298]\n `Household Income` integer, -- example: [89972, 78554]\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: ['Cocktail Glasses', '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 PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n `Sales Channel` text, -- example: ['Online', 'In-Store']\n ProcuredDate text, -- example: ['12/31/17', '4/10/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 `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 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:\n\"Cocktail Glasses\" is the Product Name; customer refers to Customer Names\nName of customers who have ordered Cocktail Glasses by online sales channel.\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: ['Florida', 'Texas', '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: ['Florida', 'Texas', 'Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\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 `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 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 Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Computers', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Florida\" and \"Texas\" are both the name of State; Computer product refers to Product Name = 'Computers; difference in unit price = Subtract (Unit Price where State = 'Florida', Unit Price where State = 'Texas')\nHow much more is the Florida store's computer product unit price than the Texas 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 SUM(CASE WHEN T3.State = 'Florida' THEN T2.`Unit Price` ELSE 0 END) - SUM(CASE WHEN T3.State = 'Texas' THEN T2.`Unit Price` ELSE 0 END) FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID WHERE T1.`Product Name` = 'Computers'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T3.State = 'Florida' THEN T2.`Unit Price` ELSE 0 END) - SUM(CASE WHEN T3.State = 'Texas' THEN T2.`Unit Price` ELSE 0 END) FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID WHERE T1.`Product Name` = 'Computers'",
"index": 1333,
"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: ['Florida', 'Texas', '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: ['Florida', 'Texas', 'Alabama', 'Arkansas']\n Type text, -- example: ['City', 'Town']\n Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\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 `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 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 Products (\n ProductID integer, -- example: [1, 2]\n `Product Name` text, -- example: ['Computers', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Florida\" and \"Texas\" are both the name of State; Computer product refers to Product Name = 'Computers; difference in unit price = Subtract (Unit Price where State = 'Florida', Unit Price where State = 'Texas')\nHow much more is the Florida store's computer product unit price than the Texas 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 `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\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: ['Midwest', 'Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n Region text, -- example: ['Midwest', 'South', 'West']\n PRIMARY KEY (StateCode)\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 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 Products (\n ProductID integer, -- example: [1, 2]\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:\norder quantity greater than 5 refers to Order Quantity > 5\nAmong sales teams in Midwest region, which sales team has an order quantity greater than 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 DISTINCT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.Region = 'Midwest' AND T1.`Order Quantity` > 5",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT DISTINCT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.Region = 'Midwest' AND T1.`Order Quantity` > 5",
"index": 1334,
"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 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: ['Midwest', 'Northeast', 'West']\n PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n Region text, -- example: ['Midwest', 'South', 'West']\n PRIMARY KEY (StateCode)\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 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 Products (\n ProductID integer, -- example: [1, 2]\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:\norder quantity greater than 5 refers to Order Quantity > 5\nAmong sales teams in Midwest region, which sales team has an order quantity greater than 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 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 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 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 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: ['ID', 'AL', 'AR']\n State text, -- example: ['California', '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: ['ID', 'AL', 'AR']\n State text, -- example: ['California', '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:\n\"California\" is the name of State; in store refers to Sales Channel = 'In-Store'; 20% discount refers to Discount Applied = '0.2'\nPlease indicate store id in the state of California that have been applied 20% discount in 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 T FROM ( SELECT DISTINCT CASE WHEN T2.State = 'California' AND T1.`Sales Channel` = 'In-Store' AND T1.`Discount Applied` = 0.2 THEN T2.StoreID END AS T FROM `Sales Orders` T1 INNER JOIN `Store Locations` T2 ON T2.StoreID = T1._StoreID ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.State = 'California' AND T1.`Sales Channel` = 'In-Store' AND T1.`Discount Applied` = 0.2 THEN T2.StoreID END AS T FROM `Sales Orders` T1 INNER JOIN `Store Locations` T2 ON T2.StoreID = T1._StoreID ) WHERE T IS NOT NULL",
"index": 1335,
"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 `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 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 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: ['ID', 'AL', 'AR']\n State text, -- example: ['California', '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: ['ID', 'AL', 'AR']\n State text, -- example: ['California', '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:\n\"California\" is the name of State; in store refers to Sales Channel = 'In-Store'; 20% discount refers to Discount Applied = '0.2'\nPlease indicate store id in the state of California that have been applied 20% discount in 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 `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: ['1/1/20', '5/31/18', '6/1/18']\n DeliveryDate text, -- example: ['1/12/20', '1/1/20', '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 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 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 Latitude real, -- example: [33.52744, 34.69901]\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:\nname of customer refers to Customer Names; from 2018 to 2020 refers to OrderDate between '1/1/2018' and '31/12/2020'; most number of order quantity refers to Order Quantity = 8\nList the name of the customer with the most number of order quantity from 2018 to 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 T1.`Customer Names` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID WHERE T2.OrderDate LIKE '%/%/18' OR T2.OrderDate LIKE '%/%/19' OR T2.OrderDate LIKE '%/%/20' ORDER BY T2.`Order Quantity` DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T1.`Customer Names` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID WHERE T2.OrderDate LIKE '%/%/18' OR T2.OrderDate LIKE '%/%/19' OR T2.OrderDate LIKE '%/%/20' ORDER BY T2.`Order Quantity` DESC LIMIT 1",
"index": 1336,
"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 PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE `Sales Orders` (\n OrderNumber text, -- example: ['SO - 0001000', 'SO - 0001001']\n OrderDate text, -- example: ['1/1/20', '5/31/18', '6/1/18']\n DeliveryDate text, -- example: ['1/12/20', '1/1/20', '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 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 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 Latitude real, -- example: [33.52744, 34.69901]\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:\nname of customer refers to Customer Names; from 2018 to 2020 refers to OrderDate between '1/1/2018' and '31/12/2020'; most number of order quantity refers to Order Quantity = 8\nList the name of the customer with the most number of order quantity from 2018 to 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 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 `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 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);\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 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 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 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:\n\"Joshua Bennett\" is the name of Sales Team\nWhich region is Joshua Bennet located in?\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 `Sales Team` = 'Joshua Bennett' THEN Region ELSE NULL END AS T FROM `Sales Team` ) WHERE T IS NOT NULL",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T FROM ( SELECT DISTINCT CASE WHEN `Sales Team` = 'Joshua Bennett' THEN Region ELSE NULL END AS T FROM `Sales Team` ) WHERE T IS NOT NULL",
"index": 1337,
"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 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 `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 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);\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 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 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 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:\n\"Joshua Bennett\" is the name of Sales Team\nWhich region is Joshua Bennet located in?\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 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 Longitude real, -- example: [-86.79905, -86.67298]\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 Regions (\n StateCode text, -- example: ['ID', 'AL', 'AR']\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 `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 PRIMARY KEY (ProductID)\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost populous country refers to Max(Population)\nWhat is the store id of the store located in the most populous county?\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 WHEN MAX(Population) THEN StoreID END FROM `Store Locations`",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT CASE WHEN MAX(Population) THEN StoreID END FROM `Store Locations`",
"index": 1338,
"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 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 Longitude real, -- example: [-86.79905, -86.67298]\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 Regions (\n StateCode text, -- example: ['ID', 'AL', 'AR']\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 `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 PRIMARY KEY (ProductID)\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost populous country refers to Max(Population)\nWhat is the store id of the store located in the most populous county?\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 Region text, -- example: ['Midwest', '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 Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\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 `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 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 Region text, -- example: ['Midwest', '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 _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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Midwest\" is the Region\nHow many sales teams are there in the Midwest?\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 Region = 'Midwest' THEN 1 ELSE 0 END) FROM `Sales Team`",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN Region = 'Midwest' THEN 1 ELSE 0 END) FROM `Sales Team`",
"index": 1339,
"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 Region text, -- example: ['Midwest', '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 Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\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 `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 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 Region text, -- example: ['Midwest', '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 _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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Midwest\" is the Region\nHow many sales teams are there in the Midwest?\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 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 Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\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 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 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:\nonline orders refers to Sales Channel = 'Online'; shipped during the month of June 2018 refers to SUBSTR(ShipDate, 1, 1) = '6' AND SUBSTR(ShipDate,-2) = '18'\nHow many online orders were shipped during the month of June 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 SUM(IIF(ShipDate LIKE '6/%/18' AND `Sales Channel` = 'Online', 1, 0)) FROM `Sales Orders`",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT SUM(IIF(ShipDate LIKE '6/%/18' AND `Sales Channel` = 'Online', 1, 0)) FROM `Sales Orders`",
"index": 1340,
"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 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 Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\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 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 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:\nonline orders refers to Sales Channel = 'Online'; shipped during the month of June 2018 refers to SUBSTR(ShipDate, 1, 1) = '6' AND SUBSTR(ShipDate,-2) = '18'\nHow many online orders were shipped during the month of June 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 `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 Products (\n ProductID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID)\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 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 _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 Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\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:\nhighest unit price refers to Max(Unit Price)\nHow much is the discount applied to the order with the highest unit price?\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 `Discount Applied` FROM `Sales Orders` WHERE REPLACE(`Unit Price`, ',', '') = ( SELECT REPLACE(`Unit Price`, ',', '') FROM `Sales Orders` ORDER BY REPLACE(`Unit Price`, ',', '') DESC LIMIT 1 ) ORDER BY REPLACE(`Unit Price`, ',', '') DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT `Discount Applied` FROM `Sales Orders` WHERE REPLACE(`Unit Price`, ',', '') = ( SELECT REPLACE(`Unit Price`, ',', '') FROM `Sales Orders` ORDER BY REPLACE(`Unit Price`, ',', '') DESC LIMIT 1 ) ORDER BY REPLACE(`Unit Price`, ',', '') DESC LIMIT 1",
"index": 1341,
"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 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 Products (\n ProductID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID)\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 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 _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 Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE `Sales Team` (\n SalesTeamID integer, -- example: [1, 2]\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:\nhighest unit price refers to Max(Unit Price)\nHow much is the discount applied to the order with the highest unit price?\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 StateCode text, -- example: ['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 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 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);\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest net profit = Max(Subtract (Unit Price, Unit Cost)); name of product refers to Product Name\nWhat is the name of the product with the highest net profit?\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.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID ORDER BY REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID ORDER BY REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') DESC LIMIT 1",
"index": 1342,
"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 StateCode text, -- example: ['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 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 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);\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest net profit = Max(Subtract (Unit Price, Unit Cost)); name of product refers to Product Name\nWhat is the name of the product with the highest net profit?\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 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 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 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 `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\n `Household Income` integer, -- example: [89972, 78554]\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest price per order after discount refers to Max(Subtract(Multiply (Unit Price, Order Quantity), Discount Applied)); name of customer refers to Customer Names\nWhat are the names of the top 3 customers who paid the highest amount of price per order after 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 `Customer Names` FROM ( SELECT T1.`Customer Names` , REPLACE(T2.`Unit Price`, ',', '') * T2.`Order Quantity` - REPLACE(T2.`Unit Price`, ',', '') * T2.`Discount Applied` AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) ORDER BY T DESC LIMIT 3",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT `Customer Names` FROM ( SELECT T1.`Customer Names` , REPLACE(T2.`Unit Price`, ',', '') * T2.`Order Quantity` - REPLACE(T2.`Unit Price`, ',', '') * T2.`Discount Applied` AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) ORDER BY T DESC LIMIT 3",
"index": 1343,
"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 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 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 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 `Store Locations` (\n StoreID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\n `Household Income` integer, -- example: [89972, 78554]\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest price per order after discount refers to Max(Subtract(Multiply (Unit Price, Order Quantity), Discount Applied)); name of customer refers to Customer Names\nWhat are the names of the top 3 customers who paid the highest amount of price per order after 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 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 `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 Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\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 - 0005951', 'SO - 0001000', 'SO - 0001001']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\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 `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 Regions (\n StateCode text, -- example: ['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:\nsales order 'SO - 0005951' refers to OrderNumber = 'SO - 0005951'; product refers to Product Name\nName the product that was registered in the sales order 'SO - 0005951'.\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.OrderNumber = 'SO - 0005951' THEN T1.`Product Name` ELSE NULL END AS T FROM Products T1 INNER JOIN `Sales Orders` 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 CASE WHEN T2.OrderNumber = 'SO - 0005951' THEN T1.`Product Name` ELSE NULL END AS T FROM Products T1 INNER JOIN `Sales Orders` T2 ON T2._ProductID = T1.ProductID ) WHERE T IS NOT NULL",
"index": 1344,
"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 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 `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 Longitude real, -- example: [-86.79905, -86.67298]\n AreaCode integer, -- example: [205, 256]\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 - 0005951', 'SO - 0001000', 'SO - 0001001']\n WarehouseCode text, -- example: ['WARE-UHY1004', 'WARE-NMK1003']\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 `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 Regions (\n StateCode text, -- example: ['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:\nsales order 'SO - 0005951' refers to OrderNumber = 'SO - 0005951'; product refers to Product Name\nName the product that was registered in the sales order 'SO - 0005951'.\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 PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\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-UHY1004', 'WARE-NMK1003']\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 `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 PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Chandler', 'Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\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:\n\"Chandler\" is the City Name; orders refers to OrderDate; in 2020 refers to Substr(OrderDate, -2) = '20'\nHow many sales orders were processed by the store located in Chandler 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 SUM(CASE WHEN T2.`City Name` = 'Chandler' AND T1.OrderDate LIKE '%/%/20' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.`City Name` = 'Chandler' AND T1.OrderDate LIKE '%/%/20' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID",
"index": 1345,
"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 PRIMARY KEY (SalesTeamID)\n);\n\nCREATE TABLE Regions (\n StateCode text, -- example: ['AL', 'AR']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\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-UHY1004', 'WARE-NMK1003']\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 `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 PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE `Store Locations` (\n StoreID integer, -- example: [1, 2]\n `City Name` text, -- example: ['Chandler', 'Birmingham', 'Huntsville']\n StateCode text, -- example: ['AL', 'AR']\n Type text, -- example: ['City', 'Town']\n Latitude real, -- example: [33.52744, 34.69901]\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:\n\"Chandler\" is the City Name; orders refers to OrderDate; in 2020 refers to Substr(OrderDate, -2) = '20'\nHow many sales orders were processed by the store located in Chandler 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 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 `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);\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 `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: ['Glendale', '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 `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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Glendale\" is the City Name; Average household income refers to avg(Household Income)\nWhat is the average household income of Glendale?\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(`Household Income`) FROM `Store Locations` WHERE `City Name` = 'Glendale'",
"style": "rule"
} | {
"db_id": "regional_sales.sqlite",
"gt_sql": "SELECT AVG(`Household Income`) FROM `Store Locations` WHERE `City Name` = 'Glendale'",
"index": 1346,
"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 `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);\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 `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: ['Glendale', '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 `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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Glendale\" is the City Name; Average household income refers to avg(Household Income)\nWhat is the average household income of Glendale?\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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Ebbsfleet', 'Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Ebbsfleet', 'Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['D', 'A']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nconsecutive games mean happen one after the other without interruption and refer to Date; tied refers to FTR = 'D';\nWhat is the most consecutive games tied by Ebbsfleet as an away team in the 2008 season?\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(*) FROM matchs WHERE season = 2008 AND AwayTeam = 'Ebbsfleet' AND FTR = 'D'",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT COUNT(*) FROM matchs WHERE season = 2008 AND AwayTeam = 'Ebbsfleet' AND FTR = 'D'",
"index": 1347,
"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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Ebbsfleet', 'Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Ebbsfleet', 'Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['D', 'A']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nconsecutive games mean happen one after the other without interruption and refer to Date; tied refers to FTR = 'D';\nWhat is the most consecutive games tied by Ebbsfleet as an away team in the 2008 season?\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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Cittadella', 'Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Cittadella', 'Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTR text, -- Final-time Results, example: ['H', 'A', 'D']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\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 games won = DIVIDE(COUNT(FTR = 'H' where HomeTeam = 'Cittadella'), COUNT(Div where HomeTeam = 'Cittadella')) as percentage; Percentage of games lost = DIVIDE(COUNT(FTR = 'A' where HomeTeam = 'Cittadella')), COUNT(Div where HomeTeam = 'Cittadella') as percentage; percentage of games drawn = DIVIDE(SUM(FTR = 'D'where HomeTeam = 'Cittadella'), COUNT(Div where HomeTeam = 'Cittadella')) as percentage;\n\nWhat percentage of games won, games lost and games drawn does Cittadella have as a home team in total?\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 FTR = 'H' THEN 1 ELSE NULL END) / COUNT(HomeTeam) AS REAL) * 100, CAST(COUNT(CASE WHEN FTR = 'A' THEN 1 ELSE NULL END) AS REAL) / COUNT(HomeTeam), CAST(COUNT(CASE WHEN FTR = 'D' THEN 1 ELSE NULL END) AS REAL) / COUNT(HomeTeam) FROM matchs WHERE HomeTeam = 'Cittadella'",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN FTR = 'H' THEN 1 ELSE NULL END) / COUNT(HomeTeam) AS REAL) * 100, CAST(COUNT(CASE WHEN FTR = 'A' THEN 1 ELSE NULL END) AS REAL) / COUNT(HomeTeam), CAST(COUNT(CASE WHEN FTR = 'D' THEN 1 ELSE NULL END) AS REAL) / COUNT(HomeTeam) FROM matchs WHERE HomeTeam = 'Cittadella'",
"index": 1348,
"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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Cittadella', 'Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Cittadella', 'Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTR text, -- Final-time Results, example: ['H', 'A', 'D']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\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 games won = DIVIDE(COUNT(FTR = 'H' where HomeTeam = 'Cittadella'), COUNT(Div where HomeTeam = 'Cittadella')) as percentage; Percentage of games lost = DIVIDE(COUNT(FTR = 'A' where HomeTeam = 'Cittadella')), COUNT(Div where HomeTeam = 'Cittadella') as percentage; percentage of games drawn = DIVIDE(SUM(FTR = 'D'where HomeTeam = 'Cittadella'), COUNT(Div where HomeTeam = 'Cittadella')) as percentage;\n\nWhat percentage of games won, games lost and games drawn does Cittadella have as a home team in total?\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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n HomeTeam text, -- example: ['Caen', 'Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Caen', 'Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCaen refers to HomeTeam; which one refers to AwayTeam; the highest winning percentage = MAX(DIVIDE(COUNT(FTR = 'A' where HomeTeam = 'Caen', season = '2010')), COUNT(Div where HomeTeam = 'Caen', season = '2010')) as percentage;\nOf all the teams that played as a team away against Caen in the 2010 season, which one has the highest winning percentage?\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 AwayTeam FROM matchs WHERE HomeTeam = 'Caen' AND season = 2010 AND FTR = 'A' GROUP BY AwayTeam ORDER BY COUNT(AwayTeam) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT AwayTeam FROM matchs WHERE HomeTeam = 'Caen' AND season = 2010 AND FTR = 'A' GROUP BY AwayTeam ORDER BY COUNT(AwayTeam) DESC LIMIT 1",
"index": 1349,
"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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n HomeTeam text, -- example: ['Caen', 'Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Caen', 'Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCaen refers to HomeTeam; which one refers to AwayTeam; the highest winning percentage = MAX(DIVIDE(COUNT(FTR = 'A' where HomeTeam = 'Caen', season = '2010')), COUNT(Div where HomeTeam = 'Caen', season = '2010')) as percentage;\nOf all the teams that played as a team away against Caen in the 2010 season, which one has the highest winning percentage?\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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n HomeTeam text, -- example: ['Sassuolo', 'Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Sassuolo', 'Charleroi', 'Mouscron']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['D', 'A']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntied games refer FTR = 'D'; DIVIDE(COUNT(Div where FTR = 'D', HomeTeam = 'Sassuolo' or AwayTeam = 'Sassuolo'), COUNT(Div where HomeTeam = 'Sassuolo' or AwayTeam = 'Sassuolo')) as percentage;\nWhat percentage of all tied games did the Sassuolo team play in?\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 HomeTeam = 'Sassuolo' OR AwayTeam = 'Sassuolo' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(FTR) FROM matchs WHERE FTR = 'D'",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN HomeTeam = 'Sassuolo' OR AwayTeam = 'Sassuolo' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(FTR) FROM matchs WHERE FTR = 'D'",
"index": 1350,
"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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n HomeTeam text, -- example: ['Sassuolo', 'Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Sassuolo', 'Charleroi', 'Mouscron']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['D', 'A']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntied games refer FTR = 'D'; DIVIDE(COUNT(Div where FTR = 'D', HomeTeam = 'Sassuolo' or AwayTeam = 'Sassuolo'), COUNT(Div where HomeTeam = 'Sassuolo' or AwayTeam = 'Sassuolo')) as percentage;\nWhat percentage of all tied games did the Sassuolo team play in?\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 matchs (\n Div text, -- Division, example: ['E2', 'B1', 'D1']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['E2', 'B1', 'D1']\n name text, -- example: ['EFL League One', 'Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\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 teams include both HomeTeam and AwayTeam; name = 'EFL League One'; DIV = 'E2';\nWhat is the name of all the teams that played in the EFL League One division?\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.HomeTeam,T1.AwayTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div=T2.division WHERE T2.name = 'EFL League One' and T1.Div = 'E2' ",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT T1.HomeTeam,T1.AwayTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div=T2.division WHERE T2.name = 'EFL League One' and T1.Div = 'E2' ",
"index": 1351,
"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 matchs (\n Div text, -- Division, example: ['E2', 'B1', 'D1']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['E2', 'B1', 'D1']\n name text, -- example: ['EFL League One', 'Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\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 teams include both HomeTeam and AwayTeam; name = 'EFL League One'; DIV = 'E2';\nWhat is the name of all the teams that played in the EFL League One division?\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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Scottish Championship', 'Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmatches refer to Div; Scottish Championship is a name of the league; equal result of 2-2 refers to FTAG = 2 AND FTHG = 2;\nHow many matches played in the 2019 season of Scottish Championship league were ended with an equal result of 2-2?\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.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2019 AND T2.name = 'Scottish Championship' AND T1.FTAG = 2 AND T1.FTHG = 2",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2019 AND T2.name = 'Scottish Championship' AND T1.FTAG = 2 AND T1.FTHG = 2",
"index": 1352,
"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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Scottish Championship', 'Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmatches refer to Div; Scottish Championship is a name of the league; equal result of 2-2 refers to FTAG = 2 AND FTHG = 2;\nHow many matches played in the 2019 season of Scottish Championship league were ended with an equal result of 2-2?\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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n FTR text, -- Final-time Results, example: ['H', 'A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['LaLiga', 'LaLiga 2', 'Division 1A', 'Bundesliga']\n country text, -- example: ['Spain', 'Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocal team refers to HomeTeam; Spanish means belong to the country = 'Spain'; LaLiga is a name of division; won as a local team refers to FTR = 'H', where H stands for home victory; DIVIDE(COUNT(Div where name = 'LaLiga', country = 'Spain', season = 2017, FRT = 'H'), COUNT(Div where name = 'LaLiga', country = 'Spain', season = 2017)) as percentage;\nFrom the Spanish LaLiga division in the 2017 season, which team won the most times as a local team and by what percentage?\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.HomeTeam HWHT , CAST(COUNT(CASE WHEN T1.FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga' AND T2.country = 'Spain' AND T1.season = 2017",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT T1.HomeTeam HWHT , CAST(COUNT(CASE WHEN T1.FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga' AND T2.country = 'Spain' AND T1.season = 2017",
"index": 1353,
"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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n FTR text, -- Final-time Results, example: ['H', 'A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['LaLiga', 'LaLiga 2', 'Division 1A', 'Bundesliga']\n country text, -- example: ['Spain', 'Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocal team refers to HomeTeam; Spanish means belong to the country = 'Spain'; LaLiga is a name of division; won as a local team refers to FTR = 'H', where H stands for home victory; DIVIDE(COUNT(Div where name = 'LaLiga', country = 'Spain', season = 2017, FRT = 'H'), COUNT(Div where name = 'LaLiga', country = 'Spain', season = 2017)) as percentage;\nFrom the Spanish LaLiga division in the 2017 season, which team won the most times as a local team and by what percentage?\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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMAX(SUM where FTHG, FTAG, season = 2021);\nWhat is the highest final-time score across all divisions in the 2021 season? Which team was the team that made up that 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 ( SELECT MAX(MAX(FTAG), MAX(FTHG)) FROM matchs WHERE season = 2021 ) AS T1, AwayTeam FROM matchs WHERE season = 2021 AND FTHG = T1 OR FTAG = T1",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT ( SELECT MAX(MAX(FTAG), MAX(FTHG)) FROM matchs WHERE season = 2021 ) AS T1, AwayTeam FROM matchs WHERE season = 2021 AND FTHG = T1 OR FTAG = T1",
"index": 1354,
"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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMAX(SUM where FTHG, FTAG, season = 2021);\nWhat is the highest final-time score across all divisions in the 2021 season? Which team was the team that made up that 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 matchs (\n Div text, -- Division, example: ['P1', 'B1', 'D1']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['P1', 'B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest final time goal refers to MAX(FTHG); P1 = Div;\nWhat is the name of the home team in division P1 with the highest final time goal in all seasons?\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 HomeTeam FROM matchs WHERE Div = 'P1' AND season = 2021 ORDER BY FTHG DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT HomeTeam FROM matchs WHERE Div = 'P1' AND season = 2021 ORDER BY FTHG DESC LIMIT 1",
"index": 1355,
"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 matchs (\n Div text, -- Division, example: ['P1', 'B1', 'D1']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['P1', 'B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest final time goal refers to MAX(FTHG); P1 = Div;\nWhat is the name of the home team in division P1 with the highest final time goal in all seasons?\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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['D', 'A']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\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 draft matches refer to MAX(COUNT(Div)) where FTR = 'D';\nWhich division had the most draft matches in the 2008 season?\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 Div FROM matchs WHERE season = 2008 AND FTR = 'D' GROUP BY Div ORDER BY COUNT(FTR) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT Div FROM matchs WHERE season = 2008 AND FTR = 'D' GROUP BY Div ORDER BY COUNT(FTR) DESC LIMIT 1",
"index": 1356,
"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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['D', 'A']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\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 draft matches refer to MAX(COUNT(Div)) where FTR = 'D';\nWhich division had the most draft matches in the 2008 season?\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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is a name of division; the highest final time goals refers to MAX(FTAG);\nWhich away team in the division of Bundesliga has the highest final time goals?\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.AwayTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div=T2.division WHERE T2.name = 'Bundesliga' ORDER BY T1.FTAG DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT T1.AwayTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div=T2.division WHERE T2.name = 'Bundesliga' ORDER BY T1.FTAG DESC LIMIT 1",
"index": 1357,
"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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is a name of division; the highest final time goals refers to MAX(FTAG);\nWhich away team in the division of Bundesliga has the highest final time goals?\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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Valencia', 'Club Brugge', 'Antwerp']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['H', 'A', 'D']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['LaLiga', 'LaLiga 2', 'Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLaLiga is a name of the division; Valencia's home team refers to HomeTeam = 'Valencia'; win refers to FTR = 'H';\nHow many times did Valencia's home team win in the LaLiga division?\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.HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga' AND T1.HomeTeam = 'Valencia' AND T1.FTR = 'H'",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT COUNT(T1.HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga' AND T1.HomeTeam = 'Valencia' AND T1.FTR = 'H'",
"index": 1358,
"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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Valencia', 'Club Brugge', 'Antwerp']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['H', 'A', 'D']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['LaLiga', 'LaLiga 2', 'Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLaLiga is a name of the division; Valencia's home team refers to HomeTeam = 'Valencia'; win refers to FTR = 'H';\nHow many times did Valencia's home team win in the LaLiga division?\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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n country text, -- example: ['England', 'Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEngland is the name of country;\nHow many football divisions does England 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(division) FROM divisions WHERE country = 'England'",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT COUNT(division) FROM divisions WHERE country = 'England'",
"index": 1359,
"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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n country text, -- example: ['England', 'Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEngland is the name of country;\nHow many football divisions does England 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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2009-04-26', '2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Denizlispor', 'Bursaspor', 'Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Denizlispor', 'Bursaspor', 'Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBursaspor vs Denizlispor are names of teams where HomeTeam = 'Bursaspor' and AwayTeam = 'Denizlispor'; Date = '2009-04-26'; final score refers to FTHG, FTAG;\nWhat was the final score for the game Bursaspor vs Denizlispor on 2009/4/26?\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 FTHG, FTAG FROM matchs WHERE Date = '2009-04-26' AND HomeTeam = 'Bursaspor' AND AwayTeam = 'Denizlispor'",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT FTHG, FTAG FROM matchs WHERE Date = '2009-04-26' AND HomeTeam = 'Bursaspor' AND AwayTeam = 'Denizlispor'",
"index": 1360,
"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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2009-04-26', '2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Denizlispor', 'Bursaspor', 'Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Denizlispor', 'Bursaspor', 'Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBursaspor vs Denizlispor are names of teams where HomeTeam = 'Bursaspor' and AwayTeam = 'Denizlispor'; Date = '2009-04-26'; final score refers to FTHG, FTAG;\nWhat was the final score for the game Bursaspor vs Denizlispor on 2009/4/26?\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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['A', 'D']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Ligue 2', 'Ligue 1', 'Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLigue 2 is the name of division; the most goals refer to MAX(SUM(FTHG, FTAG)) which are short names for Final-time Home-team Goals and Final-time Away-team Goals; winner refers to FTR = 'A';\nFor the Ligue 2 game that made the most goals, who is the winner of that game?\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 WHEN T1.FTR = 'H' THEN T1.HomeTeam ELSE T1.AwayTeam END WINNER FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Ligue 2' ORDER BY T1.FTAG + T1.FTHG DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT CASE WHEN T1.FTR = 'H' THEN T1.HomeTeam ELSE T1.AwayTeam END WINNER FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Ligue 2' ORDER BY T1.FTAG + T1.FTHG DESC LIMIT 1",
"index": 1361,
"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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['A', 'D']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Ligue 2', 'Ligue 1', 'Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLigue 2 is the name of division; the most goals refer to MAX(SUM(FTHG, FTAG)) which are short names for Final-time Home-team Goals and Final-time Away-team Goals; winner refers to FTR = 'A';\nFor the Ligue 2 game that made the most goals, who is the winner of that game?\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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2016-03-27', '2020-08-08', '2020-08-09']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['LaLiga 2', 'LaLiga', 'Division 1A', 'Bundesliga']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAway victories refer to FTR = 'A'; LaLiga 2 is the name of division; Date = '2016-03-27';\nHow many Away Victories happened on 2016/3/27 in the LaLiga 2 division?\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.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga 2' AND T1.Date = '2016-03-27' AND T1.FTR = 'A'",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT COUNT(T1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga 2' AND T1.Date = '2016-03-27' AND T1.FTR = 'A'",
"index": 1362,
"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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2016-03-27', '2020-08-08', '2020-08-09']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['LaLiga 2', 'LaLiga', 'Division 1A', 'Bundesliga']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAway victories refer to FTR = 'A'; LaLiga 2 is the name of division; Date = '2016-03-27';\nHow many Away Victories happened on 2016/3/27 in the LaLiga 2 division?\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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\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 goals refer to MAX(FTAG), which is a short name for Final-time Away-team Goals;\nWhich country had the game that Away team made the most goals?\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.country FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division GROUP BY T2.country ORDER BY SUM(T1.FTAG) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT T2.country FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division GROUP BY T2.country ORDER BY SUM(T1.FTAG) DESC LIMIT 1",
"index": 1363,
"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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\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 goals refer to MAX(FTAG), which is a short name for Final-time Away-team Goals;\nWhich country had the game that Away team made the most goals?\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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2011 refers to season; a score of 1-8 refers to FTHG = '1' and FTAG = '8';\nFor a game had a score of 1-8 in the year of 2011, what division was that game in? Give the full name of the division.\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.division, T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2011 AND T1.FTHG = 1 AND T1.FTAG = 8",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT T2.division, T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2011 AND T1.FTHG = 1 AND T1.FTAG = 8",
"index": 1364,
"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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2011 refers to season; a score of 1-8 refers to FTHG = '1' and FTAG = '8';\nFor a game had a score of 1-8 in the year of 2011, what division was that game in? Give the full name of the division.\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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['A', 'D']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than 5 total field goals refers to SUM(FTHG, FTAG)>5, which are short names for Final-time Home-team Goals and Final-time Away-team Goals; 2020/2/22 is a date;\nWhich division had the most games with more than 5 total field goals on 2020/2/22? Give the full name of the division?\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.division, T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.Date = '2020-02-22' AND T1.FTAG + T1.FTHG > 5 ORDER BY T1.FTAG + T1.FTHG DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT T2.division, T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.Date = '2020-02-22' AND T1.FTAG + T1.FTHG > 5 ORDER BY T1.FTAG + T1.FTHG DESC LIMIT 1",
"index": 1365,
"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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Division 1A', 'Bundesliga']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['A', 'D']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than 5 total field goals refers to SUM(FTHG, FTAG)>5, which are short names for Final-time Home-team Goals and Final-time Away-team Goals; 2020/2/22 is a date;\nWhich division had the most games with more than 5 total field goals on 2020/2/22? Give the full name of the division?\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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Eredivisie', 'Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEredivisie is the name of division; 2008 refers to season; teams refer to HomeTeam;\nHow many Eredivisie teams have played in 2008?\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 T1.HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Eredivisie' AND T1.season = 2008",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T1.HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Eredivisie' AND T1.season = 2008",
"index": 1366,
"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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Eredivisie', 'Division 1A', 'Bundesliga']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEredivisie is the name of division; 2008 refers to season; teams refer to HomeTeam;\nHow many Eredivisie teams have played in 2008?\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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n FTR text, -- Final-time Results, example: ['H', 'A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhome win refers to FTR = 'H', where H stands for home victory; season = '2021'; Bundesliga is a name of division; DIVIDE(COUNT(Div where FTR = 'H, season = '2021' and name = 'Bundesliga'), COUNT(Div where season = '2021' and name = 'Bundesliga')) as percentage;\nWhat's the home win ratio of the Bundesliga division in 2021?\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.FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T2.name = 'Bundesliga'",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T1.FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T2.name = 'Bundesliga'",
"index": 1367,
"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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n FTR text, -- Final-time Results, example: ['H', 'A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhome win refers to FTR = 'H', where H stands for home victory; season = '2021'; Bundesliga is a name of division; DIVIDE(COUNT(Div where FTR = 'H, season = '2021' and name = 'Bundesliga'), COUNT(Div where season = '2021' and name = 'Bundesliga')) as percentage;\nWhat's the home win ratio of the Bundesliga division in 2021?\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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; Date = '2020/10/2';\nWhich team was the home team in the match of the Bundesliga division on 2020/10/2?\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.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.Date = '2020-10-02' AND T2.name = 'Bundesliga'",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT T1.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.Date = '2020-10-02' AND T2.name = 'Bundesliga'",
"index": 1368,
"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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; Date = '2020/10/2';\nWhich team was the home team in the match of the Bundesliga division on 2020/10/2?\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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['H', 'A', 'D']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; Date = '2020/10/2'; won the match refers to FTR = 'H';\nWhich team won the match of the Bundesliga division on 2020/10/2?\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 WHEN T1.FTR = 'H' THEN T1.HomeTeam WHEN T1.FTR = 'A' THEN T1.AwayTeam END WINNER FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.Date = '2020-10-02' AND T2.name = 'Bundesliga'",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT CASE WHEN T1.FTR = 'H' THEN T1.HomeTeam WHEN T1.FTR = 'A' THEN T1.AwayTeam END WINNER FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.Date = '2020-10-02' AND T2.name = 'Bundesliga'",
"index": 1369,
"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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['H', 'A', 'D']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; Date = '2020/10/2'; won the match refers to FTR = 'H';\nWhich team won the match of the Bundesliga division on 2020/10/2?\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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n AwayTeam text, -- example: ['Werder Bremen', 'Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTR text, -- Final-time Results, example: ['A', 'D']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; win as the away team refers to FTR = 'A', where 'A' stands for away victory;\nHow many times did the team Werder Bremen win as the away team in matches of the Bundesliga division?\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.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.AwayTeam = 'Werder Bremen' AND T1.FTR = 'A'",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.AwayTeam = 'Werder Bremen' AND T1.FTR = 'A'",
"index": 1370,
"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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n AwayTeam text, -- example: ['Werder Bremen', 'Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTR text, -- Final-time Results, example: ['A', 'D']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; win as the away team refers to FTR = 'A', where 'A' stands for away victory;\nHow many times did the team Werder Bremen win as the away team in matches of the Bundesliga division?\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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; away victory refers to FTR = 'A', where 'A' stands for away victory;\nHow many matches of the Bundesliga division ended with an away victory in the 2021 season?\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.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.FTR = 'A' AND T1.season = 2021",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.FTR = 'A' AND T1.season = 2021",
"index": 1371,
"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 matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTR text, -- Final-time Results, example: ['A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\n\nCREATE TABLE divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; away victory refers to FTR = 'A', where 'A' stands for away victory;\nHow many matches of the Bundesliga division ended with an away victory in the 2021 season?\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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTR text, -- Final-time Results, example: ['D', 'A']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; tie refers to FTR = 'D', where D stands for draft;\nOf the matches in all seasons of the Bundesliga division, how many of them ended with a tie?\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.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.FTR = 'D'",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.FTR = 'D'",
"index": 1372,
"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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTR text, -- Final-time Results, example: ['D', 'A']\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; tie refers to FTR = 'D', where D stands for draft;\nOf the matches in all seasons of the Bundesliga division, how many of them ended with a tie?\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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['H', 'A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; home victory refers to refer to FTR = 'H', where H stands for home victory;\nPlease list the home teams in the matches of the Bundesliga division that ended with a home victory in the 2021 season.\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.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T1.FTR = 'H' AND T2.name = 'Bundesliga'",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT DISTINCT T1.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T1.FTR = 'H' AND T2.name = 'Bundesliga'",
"index": 1373,
"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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['H', 'A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; home victory refers to refer to FTR = 'H', where H stands for home victory;\nPlease list the home teams in the matches of the Bundesliga division that ended with a home victory in the 2021 season.\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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Augsburg', 'Mainz', 'Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Augsburg', 'Mainz', 'Charleroi', 'Mouscron']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['H', 'A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; more home victories refer to MAX(FTR = 'H)'; Augsburg and Mainz are names of teams and refer to HomeTeam;\nWhich team had more home victories in the 2021 season's matches of the Bundesliga division, Augsburg or Mainz?\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 WHEN COUNT(CASE WHEN T1.HomeTeam = 'Augsburg' THEN 1 ELSE NULL END) - COUNT(CASE WHEN T1.HomeTeam = ' Mainz' THEN 1 ELSE NULL END) > 0 THEN 'Augsburg' ELSE 'Mainz' END FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T1.FTR = 'H'",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT CASE WHEN COUNT(CASE WHEN T1.HomeTeam = 'Augsburg' THEN 1 ELSE NULL END) - COUNT(CASE WHEN T1.HomeTeam = ' Mainz' THEN 1 ELSE NULL END) > 0 THEN 'Augsburg' ELSE 'Mainz' END FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T1.FTR = 'H'",
"index": 1374,
"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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n `Date` date, -- example: ['2020-08-08', '2020-08-09']\n HomeTeam text, -- example: ['Augsburg', 'Mainz', 'Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Augsburg', 'Mainz', 'Charleroi', 'Mouscron']\n FTAG integer, -- Final-time Away-team Goals, example: [1, 0]\n FTR text, -- Final-time Results, example: ['H', 'A', 'D']\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; more home victories refer to MAX(FTR = 'H)'; Augsburg and Mainz are names of teams and refer to HomeTeam;\nWhich team had more home victories in the 2021 season's matches of the Bundesliga division, Augsburg or Mainz?\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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; final-time home-team goals refers to FTHG;\nHow many final-time home-team goals were there in total in all the matches of the Bundesliga division in the 2021 season?\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.FTHG) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.season = 2021",
"style": "rule"
} | {
"db_id": "european_football_1.sqlite",
"gt_sql": "SELECT SUM(T1.FTHG) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.season = 2021",
"index": 1375,
"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 divisions (\n division text, -- example: ['B1', 'D1']\n name text, -- example: ['Bundesliga', 'Division 1A']\n country text, -- example: ['Belgium', 'Deutschland']\n PRIMARY KEY (division)\n);\n\nCREATE TABLE matchs (\n Div text, -- Division, example: ['B1', 'D1']\n HomeTeam text, -- example: ['Club Brugge', 'Antwerp']\n AwayTeam text, -- example: ['Charleroi', 'Mouscron']\n FTHG integer, -- Final-time Home-team Goals, example: [0, 1]\n season integer, -- example: [2021, 2020]\n CONSTRAINT fk_matchs_div FOREIGN KEY (Div) REFERENCES divisions (division)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBundesliga is the name of division; final-time home-team goals refers to FTHG;\nHow many final-time home-team goals were there in total in all the matches of the Bundesliga division in the 2021 season?\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 draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n points integer, -- example: [135, 432]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Win', 'Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n college text, -- example: ['Duke', 'UCLA']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\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 winning at the home = Divide(homeWon, won) * 100\nAmong the winning game from the team, what is the percentage of the winning was home game.\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(homeWon AS REAL) * 100 / won FROM teams",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT CAST(homeWon AS REAL) * 100 / won FROM teams",
"index": 1376,
"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 draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n points integer, -- example: [135, 432]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Win', 'Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n college text, -- example: ['Duke', 'UCLA']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\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 winning at the home = Divide(homeWon, won) * 100\nAmong the winning game from the team, what is the percentage of the winning was home game.\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 awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n PostPoints integer, -- post season points, example: [4, 12]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n middleName text, -- example: ['Shareef', 'Craig']\n pos text, -- position, example: ['F-C', 'C']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhad post season (play off) refers to playoff is not null; percentage = Divide (Count(Team where rank = 1, Count(Team))) * 100\nWhat is the percentage of the teams who had post season (playoff) were ranked number 1?\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 rank = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(name) FROM teams",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN rank = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(name) FROM teams",
"index": 1377,
"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 awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n PostPoints integer, -- post season points, example: [4, 12]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n middleName text, -- example: ['Shareef', 'Craig']\n pos text, -- position, example: ['F-C', 'C']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhad post season (play off) refers to playoff is not null; percentage = Divide (Count(Team where rank = 1, Count(Team))) * 100\nWhat is the percentage of the teams who had post season (playoff) were ranked number 1?\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 player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Bo', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['ID', 'NY', 'DE']\n birthCountry text, -- example: ['BOS', 'EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['ID', 'NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['BOS', 'AFS', 'AGW']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['BOS', 'ANA', 'DNR']\n firstName text, -- example: ['Bo', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['BOS', 'POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n rebounds integer, -- example: [89, 260]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['BOS', 'PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['BOS', 'CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'BOS' is the tmID; 1950 refers to year = 1950; number of game won refers to won; number of game lost refers to lost\nWho is the coach for 'BOS' team in year 1950. List the coach ID together with the number of game won and lost.\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 coachID, won, lost FROM coaches WHERE year = 1950 AND tmID = 'BOS'",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT coachID, won, lost FROM coaches WHERE year = 1950 AND tmID = 'BOS'",
"index": 1378,
"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 player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Bo', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['ID', 'NY', 'DE']\n birthCountry text, -- example: ['BOS', 'EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['ID', 'NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['BOS', 'AFS', 'AGW']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['BOS', 'ANA', 'DNR']\n firstName text, -- example: ['Bo', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['BOS', 'POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n rebounds integer, -- example: [89, 260]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['BOS', 'PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['BOS', 'CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'BOS' is the tmID; 1950 refers to year = 1950; number of game won refers to won; number of game lost refers to lost\nWho is the coach for 'BOS' team in year 1950. List the coach ID together with the number of game won and lost.\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 series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n steals integer, -- example: [4, 25]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n awayWon integer, -- away wins, example: [5, 1]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n nameSuffix text, -- example: ['Jr.', 'III']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n birthCity text, -- example: ['Cairo', 'New York']\n birthCountry text, -- example: ['EGY', 'USA']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['ID', 'NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n assists integer, -- assistants, example: [4, 1]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1970 to 1980 refers to year between 1970 and 1980; longest serving coach Max(Count(coachID)); team(s) he served refers to tmID\nWho is the longest serving coach from year 1970 to 1980. List the coach ID and the team(s) he served.\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 coachID, tmID FROM coaches WHERE year BETWEEN 1970 AND 1980 ORDER BY stint DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT coachID, tmID FROM coaches WHERE year BETWEEN 1970 AND 1980 ORDER BY stint DESC LIMIT 1",
"index": 1379,
"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 series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n steals integer, -- example: [4, 25]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n awayWon integer, -- away wins, example: [5, 1]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n nameSuffix text, -- example: ['Jr.', 'III']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n birthCity text, -- example: ['Cairo', 'New York']\n birthCountry text, -- example: ['EGY', 'USA']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['ID', 'NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n assists integer, -- assistants, example: [4, 1]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1970 to 1980 refers to year between 1970 and 1980; longest serving coach Max(Count(coachID)); team(s) he served refers to tmID\nWho is the longest serving coach from year 1970 to 1980. List the coach ID and the team(s) he served.\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 coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n dRebounds integer, -- defense rebounds, example: [62, 179]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n pos text, -- position, example: ['F-C', 'C']\n weight integer, -- example: [240, 225]\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than 50 games won refers to won > 50\nIn year 2000, who are the coaches with more than 50 games won. List the coachID, team name and number of game won at home game.\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.coachID, T2.name, T2.won FROM coaches AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year = 2000 AND T2.won > 50",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT T1.coachID, T2.name, T2.won FROM coaches AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year = 2000 AND T2.won > 50",
"index": 1380,
"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 coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n dRebounds integer, -- defense rebounds, example: [62, 179]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n pos text, -- position, example: ['F-C', 'C']\n weight integer, -- example: [240, 225]\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than 50 games won refers to won > 50\nIn year 2000, who are the coaches with more than 50 games won. List the coachID, team name and number of game won at home game.\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 player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['adelmri01', 'abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['adelmri01', 'hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['adelmri01', 'abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_pts integer, -- offense points, example: [681, 645]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nyear 1990-1995 refers to year between 1990 and 1995; 'adelmri01' is the coachID; offense point refers to o_fgm\nWhich are the teams coached by 'adelmri01' from year 1990-1995. List the team name, year and offense point.\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.name, T1.year, T2.o_pts FROM coaches AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year BETWEEN 1990 AND 1995 AND T1.coachID = 'adelmri01'",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT T2.name, T1.year, T2.o_pts FROM coaches AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year BETWEEN 1990 AND 1995 AND T1.coachID = 'adelmri01'",
"index": 1381,
"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 player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['adelmri01', 'abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['adelmri01', 'hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['adelmri01', 'abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_pts integer, -- offense points, example: [681, 645]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nyear 1990-1995 refers to year between 1990 and 1995; 'adelmri01' is the coachID; offense point refers to o_fgm\nWhich are the teams coached by 'adelmri01' from year 1990-1995. List the team name, year and offense point.\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 awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive First Team', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n weight integer, -- example: [240, 225]\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['birthState', 'NY', 'DE']\n hsState text, -- high school state, example: ['NY', 'NJ']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n assists integer, -- assistants, example: [12, 30]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"All-Defensive First Team\" is the award; ' NY' is the birthState; 1980 to 2000 refers to year between 1980 and 2000; percentage = Divide (Count(playerID where birthState = 'NY'), Count(playerID)) * 100\nWhat is the percentage of player who won \"All-Defensive First Team\" from 1980 - 2000 is from 'NY'.\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 T1.playerID) FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T1.birthState = 'NY' AND T2.award = 'All-Defensive First Team' AND T2.year BETWEEN 1980 AND 2000",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T1.playerID) FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T1.birthState = 'NY' AND T2.award = 'All-Defensive First Team' AND T2.year BETWEEN 1980 AND 2000",
"index": 1382,
"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 awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive First Team', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n weight integer, -- example: [240, 225]\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['birthState', 'NY', 'DE']\n hsState text, -- high school state, example: ['NY', 'NJ']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n assists integer, -- assistants, example: [12, 30]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"All-Defensive First Team\" is the award; ' NY' is the birthState; 1980 to 2000 refers to year between 1980 and 2000; percentage = Divide (Count(playerID where birthState = 'NY'), Count(playerID)) * 100\nWhat is the percentage of player who won \"All-Defensive First Team\" from 1980 - 2000 is from 'NY'.\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 teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeLost integer, -- home loses, example: [1, 2]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n turnovers integer, -- example: [1, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost assist refers to Max(assists); in 1985 All Star season refers to season_id = 1985\nWhat is the birth date of the player with the most assists during the 1985 All-Star season?\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.birthDate FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T2.season_id = 1985 ORDER BY T2.assists DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT T1.birthDate FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T2.season_id = 1985 ORDER BY T2.assists DESC LIMIT 1",
"index": 1383,
"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 teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeLost integer, -- home loses, example: [1, 2]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n turnovers integer, -- example: [1, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost assist refers to Max(assists); in 1985 All Star season refers to season_id = 1985\nWhat is the birth date of the player with the most assists during the 1985 All-Star season?\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 player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['nameNick', 'Superman', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n college text, -- example: ['Brooklyn', 'Duke', 'UCLA']\n collegeOther text, -- example: ['Brooklyn', 'Santa Monica City', 'Michigan']\n birthCity text, -- example: ['birthCity', 'Brooklyn', 'Cairo', 'New York']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Brooklyn', 'Bloomfield', 'New York']\n hsState text, -- high school state, example: ['HI', 'NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Brooklyn\" is the birthCity of player; known by the name of Superman refers to nameNick like '%Superman%'; total minutes refers to Sum(minutes)\nHow many total minutes has the Brooklyn-born player, known by the name of Superman, played during all of his NBA All-Star seasons?\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.minutes) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.birthCity = 'Brooklyn' AND T1.nameNick LIKE '%Superman%'",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT SUM(T2.minutes) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.birthCity = 'Brooklyn' AND T1.nameNick LIKE '%Superman%'",
"index": 1384,
"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 player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['nameNick', 'Superman', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n college text, -- example: ['Brooklyn', 'Duke', 'UCLA']\n collegeOther text, -- example: ['Brooklyn', 'Santa Monica City', 'Michigan']\n birthCity text, -- example: ['birthCity', 'Brooklyn', 'Cairo', 'New York']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Brooklyn', 'Bloomfield', 'New York']\n hsState text, -- high school state, example: ['HI', 'NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Brooklyn\" is the birthCity of player; known by the name of Superman refers to nameNick like '%Superman%'; total minutes refers to Sum(minutes)\nHow many total minutes has the Brooklyn-born player, known by the name of Superman, played during all of his NBA All-Star seasons?\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 awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n points integer, -- example: [135, 432]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostPoints integer, -- post season points, example: [4, 12]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nof 1994 refers to year = 1994; 'NBA Coach of the Year' is the award; lost the most time at home refers to Max(homeLost)\nOf all the teams coached by the winner of the 1994 NBA Coach of the Year award, which team has lost the most times playing at home?\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 T3.tmID FROM awards_coaches AS T1 INNER JOIN coaches AS T2 ON T1.coachID = T2.coachID INNER JOIN teams AS T3 ON T3.tmID = T2.tmID WHERE T1.year = 1994 AND T1.award = 'NBA Coach of the Year' GROUP BY T3.tmID ORDER BY SUM(T3.homeLost) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT T3.tmID FROM awards_coaches AS T1 INNER JOIN coaches AS T2 ON T1.coachID = T2.coachID INNER JOIN teams AS T3 ON T3.tmID = T2.tmID WHERE T1.year = 1994 AND T1.award = 'NBA Coach of the Year' GROUP BY T3.tmID ORDER BY SUM(T3.homeLost) DESC LIMIT 1",
"index": 1385,
"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 awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n points integer, -- example: [135, 432]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostPoints integer, -- post season points, example: [4, 12]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nof 1994 refers to year = 1994; 'NBA Coach of the Year' is the award; lost the most time at home refers to Max(homeLost)\nOf all the teams coached by the winner of the 1994 NBA Coach of the Year award, which team has lost the most times playing at home?\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 series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['CSF', 'F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['LAL', 'PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['LAL', 'CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['LAL', 'POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['LAL', 'AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n o_pts integer, -- offense points, example: [681, 645]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Win', 'Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n pos text, -- position, example: ['F-C', 'C']\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n blocks integer, -- example: [2, 0]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['LAL', 'POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['LAL', 'ANA', 'DNR']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfinal round of post season refers to round = 'CSF'; won against LAL refers to tmIDLoser = 'LAL'; in the NBA league refers to lgID = 'NBA'; won more than 60 games refers to won > 60\nWhich winning team in the final round of the postseason series games against the LAL won more than 60 games in the NBA league during the year 1996?\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.tmID FROM series_post AS T1 INNER JOIN teams AS T2 ON T1.tmIDWinner = T2.tmID WHERE T2.won > 60 AND T1.year = 1996 AND T1.round = 'CSF' AND T1.tmIDLoser = 'LAL'",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT DISTINCT T2.tmID FROM series_post AS T1 INNER JOIN teams AS T2 ON T1.tmIDWinner = T2.tmID WHERE T2.won > 60 AND T1.year = 1996 AND T1.round = 'CSF' AND T1.tmIDLoser = 'LAL'",
"index": 1386,
"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 series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['CSF', 'F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['LAL', 'PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['LAL', 'CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['LAL', 'POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['LAL', 'AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n o_pts integer, -- offense points, example: [681, 645]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Win', 'Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n pos text, -- position, example: ['F-C', 'C']\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n blocks integer, -- example: [2, 0]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['LAL', 'POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['LAL', 'ANA', 'DNR']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfinal round of post season refers to round = 'CSF'; won against LAL refers to tmIDLoser = 'LAL'; in the NBA league refers to lgID = 'NBA'; won more than 60 games refers to won > 60\nWhich winning team in the final round of the postseason series games against the LAL won more than 60 games in the NBA league during the year 1996?\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 draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n awayWon integer, -- away wins, example: [5, 1]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Ha', 'Alaa', 'Kareem']\n firstName text, -- example: ['Ha', 'Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n lastseason integer, -- example: [0, 1951]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeMade integer, -- three point made, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"NBA\" is the lgID; server more than 2 teams refers to Count(tmID) = 2\nPlease list the name of the coach who has served more than 2 NBA teams.\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 coachID FROM coaches GROUP BY coachID HAVING COUNT(DISTINCT tmID) > 2",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT coachID FROM coaches GROUP BY coachID HAVING COUNT(DISTINCT tmID) > 2",
"index": 1387,
"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 draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n awayWon integer, -- away wins, example: [5, 1]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Ha', 'Alaa', 'Kareem']\n firstName text, -- example: ['Ha', 'Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n lastseason integer, -- example: [0, 1951]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeMade integer, -- three point made, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"NBA\" is the lgID; server more than 2 teams refers to Count(tmID) = 2\nPlease list the name of the coach who has served more than 2 NBA teams.\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 teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n college text, -- example: ['college', 'Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n hsState text, -- high school state, example: ['NJ', 'NY']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n blocks integer, -- example: [12, 17]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbelong to the east conference refers to divID = 'EA'\nFor the players who belongs to the east conference, please list the name of the college they went 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 T1.college FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T2.conference = 'East'",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT DISTINCT T1.college FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T2.conference = 'East'",
"index": 1388,
"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 teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n college text, -- example: ['college', 'Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n hsState text, -- high school state, example: ['NJ', 'NY']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n blocks integer, -- example: [12, 17]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbelong to the east conference refers to divID = 'EA'\nFor the players who belongs to the east conference, please list the name of the college they went 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 draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Born', 'Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Whitestone', 'birthCity', 'Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Most Valuable Player', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Whitestone\" is the birthCity of the player; won the MVP refers to award = 'Most Valuable Player'\nAmong the players born in Whitestone, how many of them have won the MVP?\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 T1.playerID) FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Most Valuable Player' AND T1.birthCity = 'Houston'",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T1.playerID) FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Most Valuable Player' AND T1.birthCity = 'Houston'",
"index": 1389,
"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 draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Born', 'Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Whitestone', 'birthCity', 'Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Most Valuable Player', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Whitestone\" is the birthCity of the player; won the MVP refers to award = 'Most Valuable Player'\nAmong the players born in Whitestone, how many of them have won the MVP?\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 player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Rookie of the Year', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Rookie', 'Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Rookie of the Year\" is the award; tallest player refers to Max(height)\nAmong the players who have won the award of Rookie of the year, what is the height of the tallest player?\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.height FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Rookie of the Year' ORDER BY T1.height DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT T1.height FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Rookie of the Year' ORDER BY T1.height DESC LIMIT 1",
"index": 1390,
"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 player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Rookie of the Year', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Rookie', 'Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Rookie of the Year\" is the award; tallest player refers to Max(height)\nAmong the players who have won the award of Rookie of the year, what is the height of the tallest player?\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 coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n turnovers integer, -- example: [1, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Rookie of the Year', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Rookie', 'Lew, Cap', 'Walt']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Rookie of the Year\" is the award; average weight = Divide (Sum(weight), Count(playerID))\nWhat is the average weight of the players who have won the award of Rookie of the year?\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(T1.weight) FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Rookie of the Year'",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT AVG(T1.weight) FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Rookie of the Year'",
"index": 1391,
"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 coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n turnovers integer, -- example: [1, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Rookie of the Year', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Rookie', 'Lew, Cap', 'Walt']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Rookie of the Year\" is the award; average weight = Divide (Sum(weight), Count(playerID))\nWhat is the average weight of the players who have won the award of Rookie of the year?\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 draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['York', 'Darrell', 'Bob']\n lastName text, -- example: ['High', 'Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['New York', 'Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['York', 'Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['High', 'Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F-C', 'C']\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['New York', 'Cairo']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['highSchool', '4 School', 'Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Most Valuable Player', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigh school in New York refers to highSchool like '%New York%'; won the MVP refers to award = 'Most Valuable Player'; average height = Divide (Sum(height), Count(playerID))\nAmong the players that went to high school in New York and have won the MVP, what is their average height?\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(T1.height) FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Most Valuable Player' AND T1.birthCity = 'New York'",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT AVG(T1.height) FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Most Valuable Player' AND T1.birthCity = 'New York'",
"index": 1392,
"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 draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['York', 'Darrell', 'Bob']\n lastName text, -- example: ['High', 'Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['New York', 'Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['York', 'Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['High', 'Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F-C', 'C']\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['New York', 'Cairo']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['highSchool', '4 School', 'Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Most Valuable Player', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigh school in New York refers to highSchool like '%New York%'; won the MVP refers to award = 'Most Valuable Player'; average height = Divide (Sum(height), Count(playerID))\nAmong the players that went to high school in New York and have won the MVP, what is their average height?\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 player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n assists integer, -- assistants, example: [4, 1]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_pts integer, -- offense points, example: [681, 645]\n homeWon integer, -- home wins, example: [8, 2]\n won integer, -- example: [14, 13]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n lastseason integer, -- example: [0, 1951]\n college text, -- example: ['Duke', 'UCLA']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2000 refers to year = 2000; team with highest score refers to Max(o_fgm)\nPlease list the top ten teams with the highest scores in 2000.\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 tmID FROM players_teams WHERE year = 2000 GROUP BY tmID ORDER BY SUM(PostPoints) DESC LIMIT 10",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT tmID FROM players_teams WHERE year = 2000 GROUP BY tmID ORDER BY SUM(PostPoints) DESC LIMIT 10",
"index": 1393,
"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 player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n assists integer, -- assistants, example: [4, 1]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_pts integer, -- offense points, example: [681, 645]\n homeWon integer, -- home wins, example: [8, 2]\n won integer, -- example: [14, 13]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n lastseason integer, -- example: [0, 1951]\n college text, -- example: ['Duke', 'UCLA']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2000 refers to year = 2000; team with highest score refers to Max(o_fgm)\nPlease list the top ten teams with the highest scores in 2000.\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 coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Win', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam with winning rate less than 50% refers to Divide (won, Sum(won, lost)) < 0.5\nWhich teams have winning rate less than 50%?\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 name FROM teams WHERE CAST(won AS REAL) * 100 / (won + lost) < 50",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT name FROM teams WHERE CAST(won AS REAL) * 100 / (won + lost) < 50",
"index": 1394,
"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 coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Win', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam with winning rate less than 50% refers to Divide (won, Sum(won, lost)) < 0.5\nWhich teams have winning rate less than 50%?\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 player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Most Valuable Player', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayed more than 3800 points refers to Sum(points) > = 3800\nHow many teams have played more than 3800 points and have player with \"Most Valuable Player\" award?\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 T4.name) FROM ( SELECT T1.name, SUM(T2.points) FROM teams AS T1 INNER JOIN players_teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN awards_players AS T3 ON T2.playerID = T3.playerID WHERE T3.award = 'Most Valuable Player' GROUP BY T1.name HAVING SUM(T2.points) >= 3800 ) AS T4",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T4.name) FROM ( SELECT T1.name, SUM(T2.points) FROM teams AS T1 INNER JOIN players_teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN awards_players AS T3 ON T2.playerID = T3.playerID WHERE T3.award = 'Most Valuable Player' GROUP BY T1.name HAVING SUM(T2.points) >= 3800 ) AS T4",
"index": 1395,
"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 player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Most Valuable Player', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayed more than 3800 points refers to Sum(points) > = 3800\nHow many teams have played more than 3800 points and have player with \"Most Valuable Player\" award?\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 player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['BLB', 'POR', 'GSW']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['BLB', 'ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['BLB', 'AFS', 'AGW']\n franchID text, -- example: ['BLB', 'AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n homeLost integer, -- home loses, example: [1, 2]\n awayLost integer, -- away loses, example: [3, 4]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['BLB', 'PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['BLB', 'CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['BLB', 'POR', 'MIL']\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"BLB\" is the tmID\nPlease list down the last name of players from \"BLB\" team.\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.lastName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.tmID = 'BLB'",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT T1.lastName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.tmID = 'BLB'",
"index": 1396,
"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 player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['BLB', 'POR', 'GSW']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['BLB', 'ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['BLB', 'AFS', 'AGW']\n franchID text, -- example: ['BLB', 'AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n homeLost integer, -- home loses, example: [1, 2]\n awayLost integer, -- away loses, example: [3, 4]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['BLB', 'PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['BLB', 'CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['BLB', 'POR', 'MIL']\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"BLB\" is the tmID\nPlease list down the last name of players from \"BLB\" team.\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 players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n college text, -- example: ['Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthCountry text, -- example: ['EGY', 'USA']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n lost integer, -- example: [4, 5]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1960 to 1975 refers to year between 1960 and 1975\nFrom 1962 to 1975, how many coaches received the award?\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 coachID) FROM awards_coaches WHERE year BETWEEN 1962 AND 1975",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT coachID) FROM awards_coaches WHERE year BETWEEN 1962 AND 1975",
"index": 1397,
"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 players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n college text, -- example: ['Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthCountry text, -- example: ['EGY', 'USA']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n lost integer, -- example: [4, 5]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1960 to 1975 refers to year between 1960 and 1975\nFrom 1962 to 1975, how many coaches received the award?\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 players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n PF integer, -- personal fouls, example: [39, 132]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['ID', 'NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['ID', 'NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1970 to 1990 refers to year between 1970 and 1990; received award twice refers to coachID where Count(coachID) = 2\nPlease list the coach IDs who received the award twice from 1970 to 1990.\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 coachID FROM awards_coaches WHERE year BETWEEN 1970 AND 1990 GROUP BY coachID, award HAVING COUNT(award) = 2",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT coachID FROM awards_coaches WHERE year BETWEEN 1970 AND 1990 GROUP BY coachID, award HAVING COUNT(award) = 2",
"index": 1398,
"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 players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n PF integer, -- personal fouls, example: [39, 132]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['ID', 'NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['ID', 'NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1970 to 1990 refers to year between 1970 and 1990; received award twice refers to coachID where Count(coachID) = 2\nPlease list the coach IDs who received the award twice from 1970 to 1990.\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 players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['ABA', 'NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['ABA', 'NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['ABA', 'NBA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['ABA', 'NBA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n weight integer, -- example: [240, 225]\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['ABA', 'NBA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1962 to 2011 refers to year between 1960 and 2011; received both NBA and ABA award refers to coachID where award LIKE 'NBA%' and 'ABA%'\nFrom 1962 to 2011, how many coaches received both NBA and ABA awards?\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 coachID) FROM awards_coaches WHERE year BETWEEN 1962 AND 2011 AND award = 'ABA Coach of the Year' AND coachID IN ( SELECT coachID FROM awards_coaches WHERE year BETWEEN 1962 AND 2011 AND award = 'NBA Coach of the Year' )",
"style": "rule"
} | {
"db_id": "professional_basketball.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT coachID) FROM awards_coaches WHERE year BETWEEN 1962 AND 2011 AND award = 'ABA Coach of the Year' AND coachID IN ( SELECT coachID FROM awards_coaches WHERE year BETWEEN 1962 AND 2011 AND award = 'NBA Coach of the Year' )",
"index": 1399,
"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 players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['ABA', 'NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['ABA', 'NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['ABA', 'NBA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['ABA', 'NBA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n weight integer, -- example: [240, 225]\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['ABA', 'NBA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1962 to 2011 refers to year between 1960 and 2011; received both NBA and ABA award refers to coachID where award LIKE 'NBA%' and 'ABA%'\nFrom 1962 to 2011, how many coaches received both NBA and ABA awards?\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.