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 productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Dragon Souveniers, Ltd.', 'Lyon Souveniers', 'Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nE-mail address belongs to employee; customerName = 'Dragon Souveniers, Ltd.';\nIf Dragon Souveniers, Ltd. aren't satisfied with their order and want to send a complain e-mail, which e-mail address should they send 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 t2.email FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t1.customerName = 'Dragon Souveniers, Ltd.'",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t2.email FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t1.customerName = 'Dragon Souveniers, Ltd.'",
"index": 800,
"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 productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Dragon Souveniers, Ltd.', 'Lyon Souveniers', 'Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nE-mail address belongs to employee; customerName = 'Dragon Souveniers, Ltd.';\nIf Dragon Souveniers, Ltd. aren't satisfied with their order and want to send a complain e-mail, which e-mail address should they send 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 customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Hernandez', 'Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Hernandez', 'Gerard', 'Murphy', 'Patterson']\n firstName text, -- example: ['Gerard', 'Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['France', 'USA']\n postalCode text, -- example: ['94080', '02107']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGerakd Hermandez is an employee; French customer refers to customer from France where country = 'France'\nHow many French customers does Gerard Hernandez take care of?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.customerNumber) FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t1.country = 'France' AND t2.firstName = 'Gerard' AND t2.lastName = 'Hernandez'",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT COUNT(t1.customerNumber) FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t1.country = 'France' AND t2.firstName = 'Gerard' AND t2.lastName = 'Hernandez'",
"index": 801,
"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 customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Hernandez', 'Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Hernandez', 'Gerard', 'Murphy', 'Patterson']\n firstName text, -- example: ['Gerard', 'Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['France', 'USA']\n postalCode text, -- example: ['94080', '02107']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGerakd Hermandez is an employee; French customer refers to customer from France where country = 'France'\nHow many French customers does Gerard Hernandez take care of?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n quantityInStock integer, -- example: [7933, 7305]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n extension text, -- example: ['x5800', 'x4611']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe latest refers to the most recent orderDate;\nWhat was the latest order that customer No.114 made? Give the name of the product.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT t3.productName FROM orderdetails AS t1 INNER JOIN orders AS t2 ON t1.orderNumber = t2.orderNumber INNER JOIN products AS t3 ON t1.productCode = t3.productCode WHERE t2.customerNumber = '114' ORDER BY t2.orderDate DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t3.productName FROM orderdetails AS t1 INNER JOIN orders AS t2 ON t1.orderNumber = t2.orderNumber INNER JOIN products AS t3 ON t1.productCode = t3.productCode WHERE t2.customerNumber = '114' ORDER BY t2.orderDate DESC LIMIT 1",
"index": 802,
"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 payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n quantityInStock integer, -- example: [7933, 7305]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n extension text, -- example: ['x5800', 'x4611']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe latest refers to the most recent orderDate;\nWhat was the latest order that customer No.114 made? Give the name of the product.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Patterson', 'Murphy']\n firstName text, -- example: ['Steve', 'Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreportsTO' is the leader of the 'employeeNumber';\nTo whom does Steve Patterson report? Please give his or her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.firstName, t2.lastName FROM employees AS t1 INNER JOIN employees AS t2 ON t2.employeeNumber = t1.reportsTo WHERE t1.firstName = 'Steve' AND t1.lastName = 'Patterson'",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t2.firstName, t2.lastName FROM employees AS t1 INNER JOIN employees AS t2 ON t2.employeeNumber = t1.reportsTo WHERE t1.firstName = 'Steve' AND t1.lastName = 'Patterson'",
"index": 803,
"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 productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Patterson', 'Murphy']\n firstName text, -- example: ['Steve', 'Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreportsTO' is the leader of the 'employeeNumber';\nTo whom does Steve Patterson report? Please give his or her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Muscle Machine Inc', 'Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['Sales Rep', 'President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n buyPrice real, -- example: [48.81, 98.58]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMuscle Machine Inc is name of customer; superior refers to 'reportsTO', who is the leader of the 'employeeNumber'\nIf I'm from the Muscle Machine Inc, to which e-mail adress should I write a letter if I want to reach the superior of my sales representitive?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.email FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t1.customerName = 'Muscle Machine Inc'",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t2.email FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t1.customerName = 'Muscle Machine Inc'",
"index": 804,
"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 orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Muscle Machine Inc', 'Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['Sales Rep', 'President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n buyPrice real, -- example: [48.81, 98.58]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMuscle Machine Inc is name of customer; superior refers to 'reportsTO', who is the leader of the 'employeeNumber'\nIf I'm from the Muscle Machine Inc, to which e-mail adress should I write a letter if I want to reach the superior of my sales representitive?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['Sales Rep', 'President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['USA', 'France']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n buyPrice real, -- example: [48.81, 98.58]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSales representative refers to jobTitle = 'Sales Rep'; country = 'USA';\nHow many sales representitives are based in the offices in the USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.employeeNumber) FROM employees AS t1 INNER JOIN offices AS t2 ON t1.officeCode = t2.officeCode WHERE t2.country = 'USA' AND t1.jobTitle = 'Sales Rep'",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT COUNT(t1.employeeNumber) FROM employees AS t1 INNER JOIN offices AS t2 ON t1.officeCode = t2.officeCode WHERE t2.country = 'USA' AND t1.jobTitle = 'Sales Rep'",
"index": 805,
"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 orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['Sales Rep', 'President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['USA', 'France']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n buyPrice real, -- example: [48.81, 98.58]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSales representative refers to jobTitle = 'Sales Rep'; country = 'USA';\nHow many sales representitives are based in the offices in the USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhere can I find the office refers to address, comprising of addressLine1 and addressLine2; President is a jobTitle\nWhere can I find the office of the President of the company?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.addressLine1, t2.addressLine2 FROM employees AS t1 INNER JOIN offices AS t2 ON t1.officeCode = t2.officeCode WHERE t1.jobTitle = 'President'",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t2.addressLine1, t2.addressLine2 FROM employees AS t1 INNER JOIN offices AS t2 ON t1.officeCode = t2.officeCode WHERE t1.jobTitle = 'President'",
"index": 806,
"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 offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhere can I find the office refers to address, comprising of addressLine1 and addressLine2; President is a jobTitle\nWhere can I find the office of the President of the company?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n state text, -- example: ['CA', 'MA']\n postalCode text, -- example: ['94080', '02107']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n extension text, -- example: ['x5800', 'x4611']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Cruz & Sons Co.', 'Atelier graphique', 'Signal Gift Stores']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCruz & Sons Co. is name of customer; 2003/3/3 refers to orderDate;\nWhich product did Cruz & Sons Co. order on 2003/3/3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 t4.productName FROM orderdetails AS t1 INNER JOIN orders AS t2 ON t1.orderNumber = t2.orderNumber INNER JOIN customers AS t3 ON t2.customerNumber = t3.customerNumber INNER JOIN products AS t4 ON t1.productCode = t4.productCode WHERE t3.customerName = 'Cruz & Sons Co.' AND t2.orderDate = '2003-03-03'",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t4.productName FROM orderdetails AS t1 INNER JOIN orders AS t2 ON t1.orderNumber = t2.orderNumber INNER JOIN customers AS t3 ON t2.customerNumber = t3.customerNumber INNER JOIN products AS t4 ON t1.productCode = t4.productCode WHERE t3.customerName = 'Cruz & Sons Co.' AND t2.orderDate = '2003-03-03'",
"index": 807,
"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 payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n state text, -- example: ['CA', 'MA']\n postalCode text, -- example: ['94080', '02107']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n extension text, -- example: ['x5800', 'x4611']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Cruz & Sons Co.', 'Atelier graphique', 'Signal Gift Stores']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCruz & Sons Co. is name of customer; 2003/3/3 refers to orderDate;\nWhich product did Cruz & Sons Co. order on 2003/3/3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n firstName text, -- example: ['Diane', 'Mary']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Cruz & Sons Co.', 'Atelier graphique', 'Signal Gift Stores']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n PRIMARY KEY (orderNumber, productCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCruz & Sons Co. is name of customer; the biggest amount refers to MAX(quantityOrdered).\nWhich product did Cruz & Sons Co. ask for the biggest amount in a single order?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT t4.productName FROM orderdetails AS t1 INNER JOIN orders AS t2 ON t1.orderNumber = t2.orderNumber INNER JOIN customers AS t3 ON t2.customerNumber = t3.customerNumber INNER JOIN products AS t4 ON t1.productCode = t4.productCode WHERE t3.customerName = 'Cruz & Sons Co.' ORDER BY t1.priceEach * t1.quantityOrdered DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t4.productName FROM orderdetails AS t1 INNER JOIN orders AS t2 ON t1.orderNumber = t2.orderNumber INNER JOIN customers AS t3 ON t2.customerNumber = t3.customerNumber INNER JOIN products AS t4 ON t1.productCode = t4.productCode WHERE t3.customerName = 'Cruz & Sons Co.' ORDER BY t1.priceEach * t1.quantityOrdered DESC LIMIT 1",
"index": 808,
"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 offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n firstName text, -- example: ['Diane', 'Mary']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Cruz & Sons Co.', 'Atelier graphique', 'Signal Gift Stores']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n PRIMARY KEY (orderNumber, productCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCruz & Sons Co. is name of customer; the biggest amount refers to MAX(quantityOrdered).\nWhich product did Cruz & Sons Co. ask for the biggest amount in a single order?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n postalCode text, -- example: ['94080', '02107']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n contactLastName text, -- example: ['Schmitt', 'King']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n postalCode text, -- example: ['44000', '83030']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1957 Chevy Pickup', '1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the amount of customers of 1957 Chevy Pickup by customers in a month?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.customerNumber) FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber WHERE T1.productCode IN ( SELECT productCode FROM products WHERE productName = '1957 Chevy Pickup' )",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT COUNT(T2.customerNumber) FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber WHERE T1.productCode IN ( SELECT productCode FROM products WHERE productName = '1957 Chevy Pickup' )",
"index": 809,
"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 orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n postalCode text, -- example: ['94080', '02107']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n contactLastName text, -- example: ['Schmitt', 'King']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n postalCode text, -- example: ['44000', '83030']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1957 Chevy Pickup', '1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the amount of customers of 1957 Chevy Pickup by customers in a month?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\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 ordered quantity product refers to productName where Max(quantityOrdered); SUBTRACT(MSRP, buyPrice);\nWhich is the most ordered quantity product? What is its expected profit margin per piece?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 productName, MSRP - buyPrice FROM products WHERE productCode = ( SELECT productCode FROM orderdetails ORDER BY quantityOrdered DESC LIMIT 1 )",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT productName, MSRP - buyPrice FROM products WHERE productCode = ( SELECT productCode FROM orderdetails ORDER BY quantityOrdered DESC LIMIT 1 )",
"index": 810,
"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 orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\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 ordered quantity product refers to productName where Max(quantityOrdered); SUBTRACT(MSRP, buyPrice);\nWhich is the most ordered quantity product? What is its expected profit margin per piece?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 productCode text, -- example: ['S10_1678', 'S10_1949']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n status text, -- example: ['Disputed', 'Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n postalCode text, -- example: ['94080', '02107']\n PRIMARY KEY (officeCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOrders that are disputed refer to status = 'Disputed'; the sales representative means employees; names refers to firstName, lastName.\nList all customer names with orders that are disputed.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.firstName, t3.lastName FROM orders AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber INNER JOIN employees AS t3 ON t2.salesRepEmployeeNumber = t3.employeeNumber WHERE t1.status = 'Disputed'",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t3.firstName, t3.lastName FROM orders AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber INNER JOIN employees AS t3 ON t2.salesRepEmployeeNumber = t3.employeeNumber WHERE t1.status = 'Disputed'",
"index": 811,
"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 productCode text, -- example: ['S10_1678', 'S10_1949']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n status text, -- example: ['Disputed', 'Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n postalCode text, -- example: ['94080', '02107']\n PRIMARY KEY (officeCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOrders that are disputed refer to status = 'Disputed'; the sales representative means employees; names refers to firstName, lastName.\nList all customer names with orders that are disputed.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 employees (\n employeeNumber integer, -- example: [1002, 1056]\n firstName text, -- example: ['Diane', 'Mary']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n contactLastName text, -- example: ['Schmitt', 'King']\n city text, -- example: ['Paris', 'Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['Paris', 'San Francisco', 'Boston']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\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(employeeNumber) when city = 'Paris'), (COUNT(employeeNumber)) as percentage;\nWhat is the percentage of employees are in Paris office?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.city = 'Paris' THEN t2.employeeNumber ELSE NULL END) AS REAL) * 100 / COUNT(t2.employeeNumber) FROM offices AS t1 INNER JOIN employees AS t2 ON t1.officeCode = t2.officeCode",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN t1.city = 'Paris' THEN t2.employeeNumber ELSE NULL END) AS REAL) * 100 / COUNT(t2.employeeNumber) FROM offices AS t1 INNER JOIN employees AS t2 ON t1.officeCode = t2.officeCode",
"index": 812,
"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 employees (\n employeeNumber integer, -- example: [1002, 1056]\n firstName text, -- example: ['Diane', 'Mary']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n contactLastName text, -- example: ['Schmitt', 'King']\n city text, -- example: ['Paris', 'Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['Paris', 'San Francisco', 'Boston']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\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(employeeNumber) when city = 'Paris'), (COUNT(employeeNumber)) as percentage;\nWhat is the percentage of employees are in Paris office?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 orders (\n orderNumber integer, -- example: [10100, 10101]\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['Japan', 'France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['Japan', 'USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJapan is the name of the country; 'reportsTO' is the leader of the 'employeeNumber';\nList the name of employees in Japan office and who are they reporting 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 t2.firstName, t2.lastName, t2.reportsTo FROM offices AS t1 INNER JOIN employees AS t2 ON t1.officeCode = t2.officeCode WHERE t1.country = 'Japan'",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t2.firstName, t2.lastName, t2.reportsTo FROM offices AS t1 INNER JOIN employees AS t2 ON t1.officeCode = t2.officeCode WHERE t1.country = 'Japan'",
"index": 813,
"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 orders (\n orderNumber integer, -- example: [10100, 10101]\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['Japan', 'France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['Japan', 'USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJapan is the name of the country; 'reportsTO' is the leader of the 'employeeNumber';\nList the name of employees in Japan office and who are they reporting 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 customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n priceEach real, -- price for each, example: [136.0, 55.09]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1939 'Chevrolet Deluxe Coupe' refers to productName; the highest price refers to MAX(priceEach)\nWhich customer ordered 1939 'Chevrolet Deluxe Coupe' at the highest 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 t4.customerName FROM products AS t1 INNER JOIN orderdetails AS t2 ON t1.productCode = t2.productCode INNER JOIN orders AS t3 ON t2.orderNumber = t3.orderNumber INNER JOIN customers AS t4 ON t3.customerNumber = t4.customerNumber WHERE t1.productName = '1939 Chevrolet Deluxe Coupe' ORDER BY t2.priceEach DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t4.customerName FROM products AS t1 INNER JOIN orderdetails AS t2 ON t1.productCode = t2.productCode INNER JOIN orders AS t3 ON t2.orderNumber = t3.orderNumber INNER JOIN customers AS t4 ON t3.customerNumber = t4.customerNumber WHERE t1.productName = '1939 Chevrolet Deluxe Coupe' ORDER BY t2.priceEach DESC LIMIT 1",
"index": 814,
"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 customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n priceEach real, -- price for each, example: [136.0, 55.09]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1939 'Chevrolet Deluxe Coupe' refers to productName; the highest price refers to MAX(priceEach)\nWhich customer ordered 1939 'Chevrolet Deluxe Coupe' at the highest 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 productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n PRIMARY KEY (officeCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUM(MULTIPLY(quantityOrdered, priceEach)\nWhat is the total price of the order 10100?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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(t.priceEach * t.quantityOrdered) FROM orderdetails t WHERE t.orderNumber = '10100'",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT SUM(t.priceEach * t.quantityOrdered) FROM orderdetails t WHERE t.orderNumber = '10100'",
"index": 815,
"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 productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n PRIMARY KEY (officeCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUM(MULTIPLY(quantityOrdered, priceEach)\nWhat is the total price of the order 10100?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\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 unit price refers to MAX(priceEach)\nPlease list the top three product names 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 t1.productName FROM products AS t1 INNER JOIN orderdetails AS t2 ON t1.productCode = t2.productCode ORDER BY t2.priceEach DESC LIMIT 3",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t1.productName FROM products AS t1 INNER JOIN orderdetails AS t2 ON t1.productCode = t2.productCode ORDER BY t2.priceEach DESC LIMIT 3",
"index": 816,
"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 employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\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 unit price refers to MAX(priceEach)\nPlease list the top three product names 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 orders (\n orderNumber integer, -- example: [10100, 10101]\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n state text, -- example: ['NV', 'Victoria']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEmployee 1370 refers to employeeNumber = '1370';\nAmong the customers of empolyee 1370, who has the highest credit limit?Please list the full name of the contact person.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.contactFirstName, t2.contactLastName FROM employees AS t1 INNER JOIN customers AS t2 ON t1.employeeNumber = t2.salesRepEmployeeNumber WHERE t1.employeeNumber = '1370' ORDER BY t2.creditLimit DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t2.contactFirstName, t2.contactLastName FROM employees AS t1 INNER JOIN customers AS t2 ON t1.employeeNumber = t2.salesRepEmployeeNumber WHERE t1.employeeNumber = '1370' ORDER BY t2.creditLimit DESC LIMIT 1",
"index": 817,
"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 orders (\n orderNumber integer, -- example: [10100, 10101]\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n state text, -- example: ['NV', 'Victoria']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEmployee 1370 refers to employeeNumber = '1370';\nAmong the customers of empolyee 1370, who has the highest credit limit?Please list the full name of the contact person.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n firstName text, -- example: ['Diane', 'Mary']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['2003 Harley-Davidson Eagle Drag Bike', '1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n buyPrice real, -- example: [48.81, 98.58]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2003 Harley-Davidson Eagle Drag Bikes refers to productName; how many ordered refers to COUNT(quantityOrdered);\nHow many 2003 Harley-Davidson Eagle Drag Bikes were ordered?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(t2.quantityOrdered) FROM products AS t1 INNER JOIN orderdetails AS t2 ON t1.productCode = t2.productCode WHERE t1.productName = '2003 Harley-Davidson Eagle Drag Bike'",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT SUM(t2.quantityOrdered) FROM products AS t1 INNER JOIN orderdetails AS t2 ON t1.productCode = t2.productCode WHERE t1.productName = '2003 Harley-Davidson Eagle Drag Bike'",
"index": 818,
"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 productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n firstName text, -- example: ['Diane', 'Mary']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['2003 Harley-Davidson Eagle Drag Bike', '1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n buyPrice real, -- example: [48.81, 98.58]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2003 Harley-Davidson Eagle Drag Bikes refers to productName; how many ordered refers to COUNT(quantityOrdered);\nHow many 2003 Harley-Davidson Eagle Drag Bikes were ordered?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCredit card does not have a limit refers to creditLimit = 45300;\nPlease list the order number of the customer whose credit card has a limit of 45300.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 orders AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber WHERE t2.creditLimit = 45300",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t1.orderNumber FROM orders AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber WHERE t2.creditLimit = 45300",
"index": 819,
"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 orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCredit card does not have a limit refers to creditLimit = 45300;\nPlease list the order number of the customer whose credit card has a limit of 45300.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMost profitable order can be computed as MAX(MULTIPLY(quantityOrdered, SUBTRACT(priceEach, buyPrice)).\nFor Which order was the most profitable, please list the customer name of the order and the profit of the order.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT t3.customerName, (t1.priceEach - t4.buyPrice) * t1.quantityOrdered FROM orderdetails AS t1 INNER JOIN orders AS t2 ON t1.orderNumber = t2.orderNumber INNER JOIN customers AS t3 ON t2.customerNumber = t3.customerNumber INNER JOIN products AS t4 ON t1.productCode = t4.productCode GROUP BY t3.customerName, t1.priceEach, t4.buyPrice, t1.quantityOrdered ORDER BY (t1.priceEach - t4.buyPrice) * t1.quantityOrdered DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t3.customerName, (t1.priceEach - t4.buyPrice) * t1.quantityOrdered FROM orderdetails AS t1 INNER JOIN orders AS t2 ON t1.orderNumber = t2.orderNumber INNER JOIN customers AS t3 ON t2.customerNumber = t3.customerNumber INNER JOIN products AS t4 ON t1.productCode = t4.productCode GROUP BY t3.customerName, t1.priceEach, t4.buyPrice, t1.quantityOrdered ORDER BY (t1.priceEach - t4.buyPrice) * t1.quantityOrdered DESC LIMIT 1",
"index": 820,
"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 orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactLastName text, -- example: ['Schmitt', 'King']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n state text, -- example: ['NV', 'Victoria']\n postalCode text, -- example: ['44000', '83030']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n state text, -- example: ['CA', 'MA']\n country text, -- example: ['USA', 'France']\n postalCode text, -- example: ['94080', '02107']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMost profitable order can be computed as MAX(MULTIPLY(quantityOrdered, SUBTRACT(priceEach, buyPrice)).\nFor Which order was the most profitable, please list the customer name of the order and the profit of the order.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n postalCode text, -- example: ['44000', '83030']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTransactions payment lower than 10000 refer to COUNT(amount) < 1000; by year refers to YEAR(paymentDate)\nHow many transactions payment made by customer that is lower than 10000. Group the result by 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 STRFTIME('%Y', t1.paymentDate), COUNT(t1.customerNumber) FROM payments AS t1 WHERE t1.amount < 10000 GROUP BY STRFTIME('%Y', t1.paymentDate)",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT STRFTIME('%Y', t1.paymentDate), COUNT(t1.customerNumber) FROM payments AS t1 WHERE t1.amount < 10000 GROUP BY STRFTIME('%Y', t1.paymentDate)",
"index": 821,
"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 productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n postalCode text, -- example: ['44000', '83030']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTransactions payment lower than 10000 refer to COUNT(amount) < 1000; by year refers to YEAR(paymentDate)\nHow many transactions payment made by customer that is lower than 10000. Group the result by 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 orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n country text, -- example: ['USA', 'France']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n quantityInStock integer, -- example: [7933, 7305]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1969 Harley Davidson Ultimate Chopper refers to the name of the product; sale rep refers to employee; 2003 refers to year(orderDate) = 2003; quantity sold refers to quantityOrdered; their names refer to the name of customers; \nList out sale rep that has sold 1969 Harley Davidson Ultimate Chopper. List out their names and quantity sold throughout 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 t5.firstName, t5.lastName, SUM(t2.quantityOrdered) FROM products AS t1 INNER JOIN orderdetails AS t2 ON t1.productCode = t2.productCode INNER JOIN orders AS t3 ON t2.orderNumber = t3.orderNumber INNER JOIN customers AS t4 ON t3.customerNumber = t4.customerNumber INNER JOIN employees AS t5 ON t4.salesRepEmployeeNumber = t5.employeeNumber WHERE t1.productName = '1969 Harley Davidson Ultimate Chopper' GROUP BY t5.lastName, t5.firstName",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t5.firstName, t5.lastName, SUM(t2.quantityOrdered) FROM products AS t1 INNER JOIN orderdetails AS t2 ON t1.productCode = t2.productCode INNER JOIN orders AS t3 ON t2.orderNumber = t3.orderNumber INNER JOIN customers AS t4 ON t3.customerNumber = t4.customerNumber INNER JOIN employees AS t5 ON t4.salesRepEmployeeNumber = t5.employeeNumber WHERE t1.productName = '1969 Harley Davidson Ultimate Chopper' GROUP BY t5.lastName, t5.firstName",
"index": 822,
"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 orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n status text, -- example: ['Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n city text, -- example: ['Nantes', 'Las Vegas']\n state text, -- example: ['NV', 'Victoria']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n country text, -- example: ['USA', 'France']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n quantityInStock integer, -- example: [7933, 7305]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1969 Harley Davidson Ultimate Chopper refers to the name of the product; sale rep refers to employee; 2003 refers to year(orderDate) = 2003; quantity sold refers to quantityOrdered; their names refer to the name of customers; \nList out sale rep that has sold 1969 Harley Davidson Ultimate Chopper. List out their names and quantity sold throughout 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 customers (\n customerNumber integer, -- example: [103, 112]\n contactFirstName text, -- example: ['Carine ', 'Jean']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n city text, -- example: ['NYC', 'Nantes', 'Las Vegas']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['Sales Rep', 'President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['NYC', 'San Francisco', 'Boston']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n postalCode text, -- example: ['94080', '02107']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNew York City refers to city = 'NYC'; sales representative refers to jobTitle = 'Sales Rep';\nWho are the sales representatives in New York City? List their full names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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, t1.firstName FROM employees AS t1 INNER JOIN offices AS t2 ON t1.officeCode = t2.officeCode WHERE t2.city = 'NYC' AND t1.jobTitle = 'Sales Rep'",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t1.lastName, t1.firstName FROM employees AS t1 INNER JOIN offices AS t2 ON t1.officeCode = t2.officeCode WHERE t2.city = 'NYC' AND t1.jobTitle = 'Sales Rep'",
"index": 823,
"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 customerNumber integer, -- example: [103, 112]\n contactFirstName text, -- example: ['Carine ', 'Jean']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n city text, -- example: ['NYC', 'Nantes', 'Las Vegas']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n lastName text, -- example: ['Murphy', 'Patterson']\n firstName text, -- example: ['Diane', 'Mary']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['Sales Rep', 'President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['NYC', 'San Francisco', 'Boston']\n addressLine1 text, -- example: ['100 Market Street', '1550 Court Place']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n postalCode text, -- example: ['94080', '02107']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNew York City refers to city = 'NYC'; sales representative refers to jobTitle = 'Sales Rep';\nWho are the sales representatives in New York City? List their full names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['GG31455', 'HQ336336', 'JM555205']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n country text, -- example: ['USA', 'France']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n state text, -- example: ['NV', 'Victoria']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIdentify the customer and list down the country with the check number GG31455.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.customerName, t2.country FROM payments AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber WHERE t1.checkNumber = 'GG31455'",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t2.customerName, t2.country FROM payments AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber WHERE t1.checkNumber = 'GG31455'",
"index": 824,
"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 productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n orderLineNumber integer, -- example: [3, 2]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['GG31455', 'HQ336336', 'JM555205']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n country text, -- example: ['USA', 'France']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n state text, -- example: ['NV', 'Victoria']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIdentify the customer and list down the country with the check number GG31455.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n extension text, -- example: ['x5800', 'x4611']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n contactLastName text, -- example: ['Schmitt', 'King']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe lowest amount of orders refers to MIN(quantityOrdered);\nWhich 5 products has the lowest amount of orders? List the product names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.productName FROM orderdetails AS t1 INNER JOIN products AS t2 ON t1.productCode = t2.productCode GROUP BY t2.productName ORDER BY SUM(t1.quantityOrdered) ASC LIMIT 5",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t2.productName FROM orderdetails AS t1 INNER JOIN products AS t2 ON t1.productCode = t2.productCode GROUP BY t2.productName ORDER BY SUM(t1.quantityOrdered) ASC LIMIT 5",
"index": 825,
"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 orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n quantityOrdered integer, -- example: [30, 50]\n priceEach real, -- price for each, example: [136.0, 55.09]\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n extension text, -- example: ['x5800', 'x4611']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n image blob,\n PRIMARY KEY (productLine)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n amount real, -- example: [6066.78, 14571.44]\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE customers (\n customerNumber integer, -- example: [103, 112]\n contactLastName text, -- example: ['Schmitt', 'King']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n city text, -- example: ['Nantes', 'Las Vegas']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productDescription text, -- example: ['This replica features working kickstand,', 'Turnable front wheels; steering function']\n quantityInStock integer, -- example: [7933, 7305]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe lowest amount of orders refers to MIN(quantityOrdered);\nWhich 5 products has the lowest amount of orders? List the product names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Disputed', 'Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n country text, -- example: ['USA', 'France']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList down the customer names with a disputed order status.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.customerName FROM customers AS t1 INNER JOIN orders AS t2 ON t1.customerNumber = t2.customerNumber WHERE t2.status = 'Disputed'",
"style": "rule"
} | {
"db_id": "car_retails.sqlite",
"gt_sql": "SELECT t1.customerName FROM customers AS t1 INNER JOIN orders AS t2 ON t1.customerNumber = t2.customerNumber WHERE t2.status = 'Disputed'",
"index": 826,
"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 customerNumber integer, -- example: [103, 112]\n customerName text, -- example: ['Atelier graphique', 'Signal Gift Stores']\n contactFirstName text, -- example: ['Carine ', 'Jean']\n phone text, -- example: ['40.32.2555', '7025551838']\n addressLine1 text, -- example: ['54, rue Royale', '8489 Strong St.']\n addressLine2 text, -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye']\n country text, -- example: ['France', 'USA']\n salesRepEmployeeNumber integer, -- sales representative employee number, example: [1370, 1166]\n creditLimit real, -- example: [21000.0, 71800.0]\n PRIMARY KEY (customerNumber),\n CONSTRAINT fk_customers_salesrepemployeenumber FOREIGN KEY (salesRepEmployeeNumber) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE orders (\n orderNumber integer, -- example: [10100, 10101]\n orderDate date, -- example: ['2003-01-06', '2003-01-09']\n requiredDate date, -- example: ['2003-01-13', '2003-01-18']\n shippedDate date, -- example: ['2003-01-10', '2003-01-11']\n status text, -- example: ['Disputed', 'Shipped', 'Resolved']\n comments text, -- example: ['Check on availability.', 'Difficult to negotiate with customer. We']\n customerNumber integer, -- example: [363, 128]\n PRIMARY KEY (orderNumber),\n CONSTRAINT fk_orders_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE employees (\n employeeNumber integer, -- example: [1002, 1056]\n firstName text, -- example: ['Diane', 'Mary']\n extension text, -- example: ['x5800', 'x4611']\n email text, -- example: ['dmurphy@classicmodelcars.com', 'mpatterso@classicmodelcars.com']\n officeCode text, -- example: ['1', '6']\n reportsTo integer, -- example: [1002, 1056]\n jobTitle text, -- example: ['President', 'VP Sales']\n PRIMARY KEY (employeeNumber),\n CONSTRAINT fk_employees_officecode FOREIGN KEY (officeCode) REFERENCES offices (officeCode),\n CONSTRAINT fk_employees_reportsto FOREIGN KEY (reportsTo) REFERENCES employees (employeeNumber)\n);\n\nCREATE TABLE products (\n productCode text, -- example: ['S10_1678', 'S10_1949']\n productName text, -- example: ['1969 Harley Davidson Ultimate Chopper', '1952 Alpine Renault 1300']\n productLine text, -- example: ['Motorcycles', 'Classic Cars']\n productScale text, -- example: ['1:10', '1:12']\n productVendor text, -- example: ['Min Lin Diecast', 'Classic Metal Creations']\n quantityInStock integer, -- example: [7933, 7305]\n buyPrice real, -- example: [48.81, 98.58]\n MSRP real, -- Manufacturer Suggested Retail Price, example: [95.7, 214.3]\n PRIMARY KEY (productCode),\n CONSTRAINT fk_products_productline FOREIGN KEY (productLine) REFERENCES productlines (productLine)\n);\n\nCREATE TABLE orderdetails (\n orderNumber integer, -- example: [10100, 10101]\n productCode text, -- example: ['S18_1749', 'S18_2248']\n PRIMARY KEY (orderNumber, productCode)\n);\n\nCREATE TABLE payments (\n customerNumber integer, -- example: [103, 112]\n checkNumber text, -- example: ['HQ336336', 'JM555205']\n paymentDate date, -- example: ['2004-10-19', '2003-06-05']\n PRIMARY KEY (customerNumber, checkNumber),\n CONSTRAINT fk_payments_customernumber FOREIGN KEY (customerNumber) REFERENCES customers (customerNumber)\n);\n\nCREATE TABLE offices (\n officeCode text, -- example: ['1', '2']\n city text, -- example: ['San Francisco', 'Boston']\n phone text, -- example: ['+1 650 219 4782', '+1 215 837 0825']\n addressLine2 text, -- example: ['Suite 300', 'Suite 102']\n country text, -- example: ['USA', 'France']\n territory text, -- example: ['NA', 'EMEA']\n PRIMARY KEY (officeCode)\n);\n\nCREATE TABLE productlines (\n productLine text, -- example: ['Classic Cars', 'Motorcycles']\n textDescription text, -- example: ['Attention car enthusiasts: Make your wil', 'Our motorcycles are state of the art rep']\n htmlDescription text,\n image blob,\n PRIMARY KEY (productLine)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList down the customer names with a disputed order status.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntop-reviewed refers to review = 4; type of food refers to food_type\n\n\nWhat types of food are served at the 4 top-reviewed restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 food_type FROM generalinfo WHERE review = ( SELECT MAX(review) FROM generalinfo ) LIMIT 4",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT food_type FROM generalinfo WHERE review = ( SELECT MAX(review) FROM generalinfo ) LIMIT 4",
"index": 827,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntop-reviewed refers to review = 4; type of food refers to food_type\n\n\nWhat types of food are served at the 4 top-reviewed restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['sonoma', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['sonoma', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['sonoma', 'alameda', 'alamo']\n county text, -- country, example: ['sonoma county', 'alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all the cities in Sonoma 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 city FROM geographic WHERE county = 'sonoma county'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT city FROM geographic WHERE county = 'sonoma county'",
"index": 828,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['sonoma', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['sonoma', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['sonoma', 'alameda', 'alamo']\n county text, -- country, example: ['sonoma county', 'alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all the cities in Sonoma 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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['california', 'church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['northern california', 'bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['california', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all cities in the Northern California 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 city FROM geographic WHERE region = 'northern california'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT city FROM geographic WHERE region = 'northern california'",
"index": 829,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['california', 'church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['northern california', 'bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['california', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all cities in the Northern California 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 geographic (\n city text, -- example: ['san francisco', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['9th avenue', 'avenue', '9th', 'church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n9th Avenue refers to street_name = '9th avenue'; San Francisco refers to City = 'san francisco'\nAt what numbers on 9th Avenue of San Francisco there are restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 id_restaurant FROM location WHERE City = 'san francisco' AND street_name = '9th avenue'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT id_restaurant FROM location WHERE City = 'san francisco' AND street_name = '9th avenue'",
"index": 830,
"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 geographic (\n city text, -- example: ['san francisco', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['9th avenue', 'avenue', '9th', 'church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n9th Avenue refers to street_name = '9th avenue'; San Francisco refers to City = 'san francisco'\nAt what numbers on 9th Avenue of San Francisco there are restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 geographic (\n city text, -- example: ['berkeley', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['adeline st', 'st', 'church st', 'el camino real']\n city text, -- example: ['berkeley', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['berkeley', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAdeline Street refers to street_name = 'adeline st'; type of food refers to food_type\n\n\nWhat type of food is there in the restaurants on Adeline Street in Berkeley city?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.food_type FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.street_name = 'adeline st' AND T2.city = 'berkeley'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T1.food_type FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.street_name = 'adeline st' AND T2.city = 'berkeley'",
"index": 831,
"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 geographic (\n city text, -- example: ['berkeley', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['adeline st', 'st', 'church st', 'el camino real']\n city text, -- example: ['berkeley', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['berkeley', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAdeline Street refers to street_name = 'adeline st'; type of food refers to food_type\n\n\nWhat type of food is there in the restaurants on Adeline Street in Berkeley city?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['a & w root beer', \"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nA&W Root Beer Restaurant refers to label = 'a & w root beer'\nIn which counties are there A&W Root Beer Restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.county FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.label = 'a & w root beer'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT DISTINCT T2.county FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.label = 'a & w root beer'",
"index": 832,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['a & w root beer', \"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nA&W Root Beer Restaurant refers to label = 'a & w root beer'\nIn which counties are there A&W Root Beer Restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['adelitas taqueria', 'taqueria', \"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstreet refers to street_name; number refers to street_num; Adelitas Taqueria Restaurant refers to label = 'adelitas taqueria'\nIndicate street and number of the Adelitas Taqueria Restaurants.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.street_name, T1.street_num FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.label = 'adelitas taqueria'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T1.street_name, T1.street_num FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.label = 'adelitas taqueria'",
"index": 833,
"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 geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['adelitas taqueria', 'taqueria', \"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstreet refers to street_name; number refers to street_num; Adelitas Taqueria Restaurant refers to label = 'adelitas taqueria'\nIndicate street and number of the Adelitas Taqueria Restaurants.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['seafood', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['san francisco', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstreet refers to street_name; seafood refers to food_type = 'seafood'\nIn which streets of the city of San Francisco are there restaurants that serve seafood?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.street_name FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.city = 'san francisco' AND T2.food_type = 'seafood' AND street_name IS NOT NULL",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T1.street_name FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.city = 'san francisco' AND T2.food_type = 'seafood' AND street_name IS NOT NULL",
"index": 834,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['seafood', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['san francisco', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstreet refers to street_name; seafood refers to food_type = 'seafood'\nIn which streets of the city of San Francisco are there restaurants that serve seafood?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['bakers square restaurant & pie shop', 'bakers square restaurant & pie', 'bakers square restaurant & pies', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno Bakers Square Restaurant & Pie Shop refers to label <> 'bakers square restaurant & pie shop'\nList all counties where there is no Bakers Square Restaurant & Pie Shop.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.county FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.label != 'bakers square restaurant & pie shop'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT DISTINCT T2.county FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.label != 'bakers square restaurant & pie shop'",
"index": 835,
"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 geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['bakers square restaurant & pie shop', 'bakers square restaurant & pie', 'bakers square restaurant & pies', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno Bakers Square Restaurant & Pie Shop refers to label <> 'bakers square restaurant & pie shop'\nList all counties where there is no Bakers Square Restaurant & Pie Shop.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['appian way', 'way', 'church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\na street called Appian Way refers to street_name = 'appian way'\nIn how many counties is there a street called Appian Way?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.county) FROM location AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.street_name = 'appian way'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T2.county) FROM location AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.street_name = 'appian way'",
"index": 836,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['appian way', 'way', 'church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\na street called Appian Way refers to street_name = 'appian way'\nIn how many counties is there a street called Appian Way?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['contra costa county', 'alameda county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIdentify all restaurants in Contra Costa County by id.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.id_restaurant FROM location AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T2.county = 'contra costa county'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T1.id_restaurant FROM location AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T2.county = 'contra costa county'",
"index": 837,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['contra costa county', 'alameda county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIdentify all restaurants in Contra Costa County by id.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['american', '24 hour diner', 'afghani']\n city text, -- example: ['san rafael', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['san rafael', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['drive', 'church st', 'el camino real']\n city text, -- example: ['san rafael', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDrive Street refers to street_name = 'drive'; San Rafael refers to city = 'san rafael'; American food refers to food_type <> 'american'\nWhat restaurant on Drive Street in San Rafael doesn't serve American food?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.label FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.street_name = 'drive' AND T1.food_type != 'american' AND T2.city = 'san rafael'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T1.label FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.street_name = 'drive' AND T1.food_type != 'american' AND T2.city = 'san rafael'",
"index": 838,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['american', '24 hour diner', 'afghani']\n city text, -- example: ['san rafael', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['san rafael', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['drive', 'church st', 'el camino real']\n city text, -- example: ['san rafael', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDrive Street refers to street_name = 'drive'; San Rafael refers to city = 'san rafael'; American food refers to food_type <> 'american'\nWhat restaurant on Drive Street in San Rafael doesn't serve American food?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 geographic (\n city text, -- example: ['san francisco', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstreet refers to street_name; review of 1.7 refers to review = 1.7\nOn which streets in the city of San Francisco are there restaurants with a review of 1.7?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.street_name FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.city = 'san francisco' AND T1.review = 1.7",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T2.street_name FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.city = 'san francisco' AND T1.review = 1.7",
"index": 839,
"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 geographic (\n city text, -- example: ['san francisco', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstreet refers to street_name; review of 1.7 refers to review = 1.7\nOn which streets in the city of San Francisco are there restaurants with a review of 1.7?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['menlo park', 'alameda', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['menlo park', 'alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['alameda de las pulgas', 'park', 'church st', 'el camino real']\n city text, -- example: ['menlo park', 'alameda', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurant refers to label; street Alameda de las Pulgas refers to street_name = 'avenida de las pulgas'; the worst rated refers to min(review)\nWhich restaurant on the street Alameda de las Pulgas in the city of Menlo Park is the worst rated?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.label FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.street_name = 'avenida de las pulgas' AND T2.city = 'menlo park' ORDER BY review LIMIT 1",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T2.label FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.street_name = 'avenida de las pulgas' AND T2.city = 'menlo park' ORDER BY review LIMIT 1",
"index": 840,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['menlo park', 'alameda', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['menlo park', 'alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['alameda de las pulgas', 'park', 'church st', 'el camino real']\n city text, -- example: ['menlo park', 'alameda', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurant refers to label; street Alameda de las Pulgas refers to street_name = 'avenida de las pulgas'; the worst rated refers to min(review)\nWhich restaurant on the street Alameda de las Pulgas in the city of Menlo Park is the worst rated?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['tuolumne county', 'alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['good heavens', \"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstreet refers to street_name; Good Heavens restaurant refers to label = 'good heavens'\nOn what street in Tuolumne County is Good Heavens restaurant located?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.street_name FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant INNER JOIN geographic AS T3 ON T2.city = T3.city WHERE T2.label = 'good heavens' AND T3.county = 'tuolumne county'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T1.street_name FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant INNER JOIN geographic AS T3 ON T2.city = T3.city WHERE T2.label = 'good heavens' AND T3.county = 'tuolumne county'",
"index": 841,
"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 geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['tuolumne county', 'alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['good heavens', \"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstreet refers to street_name; Good Heavens restaurant refers to label = 'good heavens'\nOn what street in Tuolumne County is Good Heavens restaurant located?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['marin county', 'alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIdentify all the restaurants in Marin County by their id.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.id_restaurant FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T2.county = 'marin county'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T1.id_restaurant FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T2.county = 'marin county'",
"index": 842,
"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 geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['marin county', 'alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIdentify all the restaurants in Marin County by their id.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['pizza', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['pizza', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno pizza restaurants refers to food_type = 'pizza'\nIn which regions are there no pizza restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.region FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.food_type = 'pizza' AND T2.region != 'unknown'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT DISTINCT T2.region FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.food_type = 'pizza' AND T2.region != 'unknown'",
"index": 843,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['pizza', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['pizza', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno pizza restaurants refers to food_type = 'pizza'\nIn which regions are there no pizza restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['alameda', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['11th st', '11th', 'st', 'church st', 'el camino real']\n city text, -- example: ['alameda', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstreet named 11th Street refers to street_name = '11th st'; percentage = divide(count(street_name = '11th st' and County = 'alameda county'), count(street_name where County = 'alameda county')) * 100%\nWhat percentage of streets named 11th Street are in Alameda 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 CAST(SUM(IIF(T1.street_name = '11th st', 1, 0)) AS REAL) * 100 / COUNT(T1.id_restaurant) FROM location AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T2.County = 'alameda county'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT CAST(SUM(IIF(T1.street_name = '11th st', 1, 0)) AS REAL) * 100 / COUNT(T1.id_restaurant) FROM location AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T2.County = 'alameda county'",
"index": 844,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['alameda', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['11th st', '11th', 'st', 'church st', 'el camino real']\n city text, -- example: ['alameda', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstreet named 11th Street refers to street_name = '11th st'; percentage = divide(count(street_name = '11th st' and County = 'alameda county'), count(street_name where County = 'alameda county')) * 100%\nWhat percentage of streets named 11th Street are in Alameda 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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['northern california', 'bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNorthern California refers to region = 'northern california'\nWhat cities are located in Northern California?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT city FROM geographic WHERE region = 'northern california'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT city FROM geographic WHERE region = 'northern california'",
"index": 845,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['northern california', 'bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNorthern California refers to region = 'northern california'\nWhat cities are located in Northern California?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n24-hour diner refers to food_type = '24 hour diner'; diner name refers to label\nWhat does the one and only 24-hour diner's name?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 label FROM generalinfo WHERE food_type = '24 hour diner'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT label FROM generalinfo WHERE food_type = '24 hour diner'",
"index": 846,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n24-hour diner refers to food_type = '24 hour diner'; diner name refers to label\nWhat does the one and only 24-hour diner's name?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['unknown', 'alameda county', 'contra costa county']\n region text, -- example: ['unknown', 'bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nunidentified county and region refers to county = 'unknown' AND region = 'unknown'\nPlease list any five cities that have an unidentified county and 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 city FROM geographic WHERE county = 'unknown' AND region = 'unknown' LIMIT 5",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT city FROM geographic WHERE county = 'unknown' AND region = 'unknown' LIMIT 5",
"index": 847,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['unknown', 'alameda county', 'contra costa county']\n region text, -- example: ['unknown', 'bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nunidentified county and region refers to county = 'unknown' AND region = 'unknown'\nPlease list any five cities that have an unidentified county and 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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['davis', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['davis', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['davis', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the county and region of Davis City?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT county, region FROM geographic WHERE city = 'Davis'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT county, region FROM geographic WHERE city = 'Davis'",
"index": 848,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['davis', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['davis', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['davis', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the county and region of Davis City?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geographic (\n city text, -- example: ['san francisco', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['diner', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\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 popular refers to max(review); restaurant refers to label; San Francisco refers to city = 'San Francisco'\nWhat are the most popular restaurants in San Francisco among diners?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 id_restaurant, label FROM generalinfo WHERE city = 'San Francisco' AND review = ( SELECT MAX(review) FROM generalinfo WHERE city = 'San Francisco' )",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT id_restaurant, label FROM generalinfo WHERE city = 'San Francisco' AND review = ( SELECT MAX(review) FROM generalinfo WHERE city = 'San Francisco' )",
"index": 849,
"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 geographic (\n city text, -- example: ['san francisco', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['diner', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\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 popular refers to max(review); restaurant refers to label; San Francisco refers to city = 'San Francisco'\nWhat are the most popular restaurants in San Francisco among diners?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 geographic (\n city text, -- example: ['carmel', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['carmel', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['american', '24 hour diner', 'afghani']\n city text, -- example: ['carmel', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmerican Food Restaurant refers to food_type = 'ameraican'; unpopular refers to min(review); Carmel refers to city = 'Carmel'\nHow many American food restaurants are unpopular in Carmel?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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(id_restaurant) FROM generalinfo WHERE food_type = 'american' AND city = 'carmel' AND review = ( SELECT MIN(review) FROM generalinfo WHERE food_type = 'american' AND city = 'carmel' )",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT COUNT(id_restaurant) FROM generalinfo WHERE food_type = 'american' AND city = 'carmel' AND review = ( SELECT MIN(review) FROM generalinfo WHERE food_type = 'american' AND city = 'carmel' )",
"index": 850,
"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 geographic (\n city text, -- example: ['carmel', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['carmel', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['american', '24 hour diner', 'afghani']\n city text, -- example: ['carmel', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmerican Food Restaurant refers to food_type = 'ameraican'; unpopular refers to min(review); Carmel refers to city = 'Carmel'\nHow many American food restaurants are unpopular in Carmel?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"albert's cafe\", \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull address = street_num, street_name, city; Albert's Café refers to label = 'Albert's Café'\nWhat is the full address of Albert's Café?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.street_num, T2.street_name, T1.city FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.label = 'Albert''s Café'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T2.street_num, T2.street_name, T1.city FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.label = 'Albert''s Café'",
"index": 851,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"albert's cafe\", \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull address = street_num, street_name, city; Albert's Café refers to label = 'Albert's Café'\nWhat is the full address of Albert's Café?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['s san tomas aquino rd', 'n san tomas aquino rd', 'san tomas aquino rd.', 'church st', 'el camino real']\n city text, -- example: ['campbell', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['campbell', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['chinese restaurant', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['chinese', '24 hour diner', 'afghani']\n city text, -- example: ['campbell', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurant name refers to label; Chinese restaurant refers to food_type = 'chinese'; 104 San Tomas Aquino Road Campbell refers to street_num = 104 AND street_name = 'san tomas aquino road' AND city = 'campbell'\nWhat is the name of the Chinese restaurant that can be found at 104 San Tomas Aquino Road, Campbell?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.label FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.street_num = 104 AND T1.city = 'campbell' AND T2.street_name = 'san tomas aquino road'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T1.label FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.street_num = 104 AND T1.city = 'campbell' AND T2.street_name = 'san tomas aquino road'",
"index": 852,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['s san tomas aquino rd', 'n san tomas aquino rd', 'san tomas aquino rd.', 'church st', 'el camino real']\n city text, -- example: ['campbell', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['campbell', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['chinese restaurant', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['chinese', '24 hour diner', 'afghani']\n city text, -- example: ['campbell', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurant name refers to label; Chinese restaurant refers to food_type = 'chinese'; 104 San Tomas Aquino Road Campbell refers to street_num = 104 AND street_name = 'san tomas aquino road' AND city = 'campbell'\nWhat is the name of the Chinese restaurant that can be found at 104 San Tomas Aquino Road, Campbell?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['san pablo ave', 'pablo ave', 'ave', 'san pablo ave.', 'pablo ave.', 'church st']\n city text, -- example: ['san pablo', 'albany', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['my thai', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['thai', '24 hour diner', 'afghani']\n city text, -- example: ['san pablo', 'albany', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['san pablo', 'albany', 'alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThai restaurant refers to food_type = 'thai'; San Pablo Ave Albany refers to street_name = 'san pablo ave' AND T1.city = 'albany'\nHow many Thai restaurants can be found in San Pablo Ave, Albany?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.id_restaurant) FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.food_type = 'thai' AND T1.city = 'albany' AND T2.street_name = 'san pablo ave'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT COUNT(T1.id_restaurant) FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.food_type = 'thai' AND T1.city = 'albany' AND T2.street_name = 'san pablo ave'",
"index": 853,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['san pablo ave', 'pablo ave', 'ave', 'san pablo ave.', 'pablo ave.', 'church st']\n city text, -- example: ['san pablo', 'albany', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['my thai', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['thai', '24 hour diner', 'afghani']\n city text, -- example: ['san pablo', 'albany', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['san pablo', 'albany', 'alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThai restaurant refers to food_type = 'thai'; San Pablo Ave Albany refers to street_name = 'san pablo ave' AND T1.city = 'albany'\nHow many Thai restaurants can be found in San Pablo Ave, Albany?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['plearn-thai cuisine', 'thai cuisine', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['thai', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlearn-Thai Cuisine restaurant refers to label = 'plearn-thai cuisine'\nWhat is the county and region of Plearn-Thai Cuisine restaurant?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.county, T1.region, T2.label FROM geographic AS T1 INNER JOIN generalinfo AS T2 ON T1.city = T2.city WHERE T2.label = 'plearn-thai cuisine'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T1.county, T1.region, T2.label FROM geographic AS T1 INNER JOIN generalinfo AS T2 ON T1.city = T2.city WHERE T2.label = 'plearn-thai cuisine'",
"index": 854,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['plearn-thai cuisine', 'thai cuisine', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['thai', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlearn-Thai Cuisine restaurant refers to label = 'plearn-thai cuisine'\nWhat is the county and region of Plearn-Thai Cuisine restaurant?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['e. el camino real', 'el camino real', 'e. el camino', 'camino real', 'el camino', 'camino']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstreet E. El Camino Real refers to street_name = 'E. El Camino Real'\nWhich county and region does the street E. El Camino Real belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.county, T2.region FROM location AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.street_name = 'E. El Camino Real'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT DISTINCT T2.county, T2.region FROM location AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.street_name = 'E. El Camino Real'",
"index": 855,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['e. el camino real', 'el camino real', 'e. el camino', 'camino real', 'el camino', 'camino']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstreet E. El Camino Real refers to street_name = 'E. El Camino Real'\nWhich county and region does the street E. El Camino Real belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geographic (\n city text, -- example: ['berkeley', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['shattuck ave', 'shattuck', 'avenue', 'ave', 'shattuck ave.', 'church st']\n city text, -- example: ['berkeley', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['sagar indian restaurant', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['indian', '24 hour diner', 'afghani']\n city text, -- example: ['berkeley', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurant name refers to label; the least popular refers to min(review); Indian restaurant refers to food_type = 'Indian restaurant'; Shattuck Avenue in Berkeley refers to street_name = 'shattuck ave' and city = 'berkeley'\nWhat is the name of the least popular Indian restaurant on Shattuck Avenue in Berkeley?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.id_restaurant FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.city = 'berkeley' AND T2.street_name = 'shattuck ave' AND T1.food_type = 'Indian restaurant' ORDER BY T1.review LIMIT 1",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T1.id_restaurant FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.city = 'berkeley' AND T2.street_name = 'shattuck ave' AND T1.food_type = 'Indian restaurant' ORDER BY T1.review LIMIT 1",
"index": 856,
"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 geographic (\n city text, -- example: ['berkeley', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['shattuck ave', 'shattuck', 'avenue', 'ave', 'shattuck ave.', 'church st']\n city text, -- example: ['berkeley', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['sagar indian restaurant', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['indian', '24 hour diner', 'afghani']\n city text, -- example: ['berkeley', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurant name refers to label; the least popular refers to min(review); Indian restaurant refers to food_type = 'Indian restaurant'; Shattuck Avenue in Berkeley refers to street_name = 'shattuck ave' and city = 'berkeley'\nWhat is the name of the least popular Indian restaurant on Shattuck Avenue in Berkeley?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 geographic (\n city text, -- example: ['san mateo', 'alameda', 'alamo']\n county text, -- country, example: ['san mateo county', 'alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san mateo', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n city text, -- example: ['san mateo', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList every city in San Mateo 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 city FROM geographic WHERE county = 'san mateo county'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT city FROM geographic WHERE county = 'san mateo county'",
"index": 857,
"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 geographic (\n city text, -- example: ['san mateo', 'alameda', 'alamo']\n county text, -- country, example: ['san mateo county', 'alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san mateo', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n city text, -- example: ['san mateo', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList every city in San Mateo 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 location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstreet refers to street_name; the most restaurants refers to max(count(street_name))\nWhich street has the most restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 street_name FROM location GROUP BY street_name ORDER BY COUNT(street_name) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT street_name FROM location GROUP BY street_name ORDER BY COUNT(street_name) DESC LIMIT 1",
"index": 858,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstreet refers to street_name; the most restaurants refers to max(count(street_name))\nWhich street has the most restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 geographic (\n city text, -- example: ['alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['chicken', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nchicken restaurant refers to food_type = 'chicken'; the highest review refers to max(review)\nWhich chicken restaurant has the highest review?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT label FROM generalinfo WHERE food_type = 'chicken' ORDER BY review DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT label FROM generalinfo WHERE food_type = 'chicken' ORDER BY review DESC LIMIT 1",
"index": 859,
"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 geographic (\n city text, -- example: ['alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['chicken', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nchicken restaurant refers to food_type = 'chicken'; the highest review refers to max(review)\nWhich chicken restaurant has the highest review?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['el cerrito', 'cerritos', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['el cerrito', 'cerritos', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['el cerrito', 'cerritos', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEl Cerrito refers to city = 'el cerrito'\nWhich county is El Cerrito from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 county FROM geographic WHERE city = 'el cerrito'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT county FROM geographic WHERE city = 'el cerrito'",
"index": 860,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['el cerrito', 'cerritos', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['el cerrito', 'cerritos', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['el cerrito', 'cerritos', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEl Cerrito refers to city = 'el cerrito'\nWhich county is El Cerrito from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['marin county', 'alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurant refers to label\nProvide a list of restaurants from Marin 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 T1.label FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T2.county = 'marin county'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T1.label FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T2.county = 'marin county'",
"index": 861,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['marin county', 'alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurant refers to label\nProvide a list of restaurants from Marin 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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['greek', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGreek restaurant refers to food_type = 'greek'\nWhat are the regions with Greek restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.region FROM geographic AS T1 INNER JOIN generalinfo AS T2 ON T1.city = T2.city WHERE T2.food_type = 'greek'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT DISTINCT T1.region FROM geographic AS T1 INNER JOIN generalinfo AS T2 ON T1.city = T2.city WHERE T2.food_type = 'greek'",
"index": 862,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['greek', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGreek restaurant refers to food_type = 'greek'\nWhat are the regions with Greek restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['el camino real', 'camino real', 'el camino', 'camino', 's el camino real', 'e el camino']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1149 El Camino Real refers to street_num = 1149 and street_name = 'el camino real'\nWhat is the region of 1149 El Camino Real?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.region FROM location AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.street_num = 1149 AND T1.street_name = 'el camino real'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T2.region FROM location AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.street_num = 1149 AND T1.street_name = 'el camino real'",
"index": 863,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['el camino real', 'camino real', 'el camino', 'camino', 's el camino real', 'e el camino']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1149 El Camino Real refers to street_num = 1149 and street_name = 'el camino real'\nWhat is the region of 1149 El Camino Real?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['sankee', \"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSankee restaurant refers to label = 'sankee'\nWhat is the county of the Sankee restaurant?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.county FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.label = 'sankee'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T2.county FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.label = 'sankee'",
"index": 864,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['sankee', \"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSankee restaurant refers to label = 'sankee'\nWhat is the county of the Sankee restaurant?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['northern california', 'bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['california', 'church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['california', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\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 streets with restaurants are there in the Northern California 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(T1.city) FROM geographic AS T1 INNER JOIN location AS T2 ON T1.city = T2.city WHERE T1.region = 'northern california'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT COUNT(T1.city) FROM geographic AS T1 INNER JOIN location AS T2 ON T1.city = T2.city WHERE T1.region = 'northern california'",
"index": 865,
"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 geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['northern california', 'bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['california', 'church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['california', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\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 streets with restaurants are there in the Northern California 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 geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['chinese', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChinese restaurant refers to food_type = 'chinese'; average review refers to divide(sum(review), count(review))\nList all the average reviews of Chinese restaurants for each county from highest to lowest.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.review) FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.food_type = 'chinese' GROUP BY T1.id_restaurant ORDER BY AVG(T1.review) DESC",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT AVG(T1.review) FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.food_type = 'chinese' GROUP BY T1.id_restaurant ORDER BY AVG(T1.review) DESC",
"index": 866,
"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 geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['chinese', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChinese restaurant refers to food_type = 'chinese'; average review refers to divide(sum(review), count(review))\nList all the average reviews of Chinese restaurants for each county from highest to lowest.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['san francisco', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['francisco ct', 'church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList street names in San Francisco city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT street_name FROM location WHERE city = 'San Francisco'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT street_name FROM location WHERE city = 'San Francisco'",
"index": 867,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['san francisco', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['francisco ct', 'church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList street names in San Francisco city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['danville', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['danville', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['danville', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList restaurant ids located in Danville city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT id_restaurant FROM location WHERE city = 'Danville'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT id_restaurant FROM location WHERE city = 'Danville'",
"index": 868,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['danville', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['danville', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['danville', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList restaurant ids located in Danville city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Bay Area refers to region = 'bay area'\nHow many cities are located in the Bay Area?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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(city) FROM geographic WHERE region = 'bay area'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT COUNT(city) FROM geographic WHERE region = 'bay area'",
"index": 869,
"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 geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Bay Area refers to region = 'bay area'\nHow many cities are located in the Bay Area?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['unknown', 'alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nunknown county refers to county = 'unknown'\nHow many labels of the restaurant have an unknown country?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.label) FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T2.county = 'unknown'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT COUNT(T1.label) FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T2.county = 'unknown'",
"index": 870,
"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 geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['unknown', 'alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nunknown county refers to county = 'unknown'\nHow many labels of the restaurant have an unknown country?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['broadway', 'church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n430 Broadway refers to street_num = 430 and street_name = 'Broadway'\nGive the review of the restaurant at 430, Broadway.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.review FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.street_name = 'Broadway' AND T2.street_num = 430",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T1.review FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.street_name = 'Broadway' AND T2.street_num = 430",
"index": 871,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['broadway', 'church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n430 Broadway refers to street_num = 430 and street_name = 'Broadway'\nGive the review of the restaurant at 430, Broadway.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['napa', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['napa', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['napa', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['napa valley', 'bay area']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNapa Valley refers to region = 'Napa Valley'; percentage = divide(count(id_restaurant where region = 'Napa Valley'), count(id_restaurant)) * 100%\nFind the percentage of restaurant in Napa Valley.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(IIF(region = 'Napa Valley', 1, 0)) AS REAL) * 100 / COUNT(region) FROM geographic",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT CAST(SUM(IIF(region = 'Napa Valley', 1, 0)) AS REAL) * 100 / COUNT(region) FROM geographic",
"index": 872,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['napa', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['napa', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['napa', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['napa valley', 'bay area']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNapa Valley refers to region = 'Napa Valley'; percentage = divide(count(id_restaurant where region = 'Napa Valley'), count(id_restaurant)) * 100%\nFind the percentage of restaurant in Napa Valley.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBay Area refers to region = 'bay area'\nHow many of the cities are in a Bay Area?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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(city) FROM geographic WHERE region = 'bay area'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT COUNT(city) FROM geographic WHERE region = 'bay area'",
"index": 873,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBay Area refers to region = 'bay area'\nHow many of the cities are in a Bay Area?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['santa clara', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['santa clara', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['santa clara', 'alameda', 'alamo']\n county text, -- country, example: ['santa clara county', 'alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBay Area refers to region = 'bay area'; Santa Clara refers to county = 'santa clara county'\nWhat is the city located in Bay Area of Santa Clara?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT city FROM geographic WHERE region = 'bay area' AND county = 'santa clara county'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT city FROM geographic WHERE region = 'bay area' AND county = 'santa clara county'",
"index": 874,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['santa clara', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['santa clara', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['santa clara', 'alameda', 'alamo']\n county text, -- country, example: ['santa clara county', 'alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBay Area refers to region = 'bay area'; Santa Clara refers to county = 'santa clara county'\nWhat is the city located in Bay Area of Santa Clara?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['san francisco', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname refers to label; 24 hour diner refers to food_type = '24 hour diner'; San Francisco refers to city = 'san francisco'\nWhat is the name of the 24 hour diner at San Francisco?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 label FROM generalinfo WHERE food_type = '24 hour diner' AND city = 'san francisco'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT label FROM generalinfo WHERE food_type = '24 hour diner' AND city = 'san francisco'",
"index": 875,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['san francisco', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname refers to label; 24 hour diner refers to food_type = '24 hour diner'; San Francisco refers to city = 'san francisco'\nWhat is the name of the 24 hour diner at San Francisco?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 geographic (\n city text, -- example: ['santa cruz', 'alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['santa cruz', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['santa cruz', 'ocean st', 'ocean', 'cruz', 'st.', 'st']\n city text, -- example: ['santa cruz', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOcean St. refers to street_name = 'ocean st'; Santa Cruz refers to city = 'santa cruz'\nGive the review of the restaurant located in Ocean St., Santa Cruz.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.review FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.city = 'santa cruz' AND T1.street_name = 'ocean st'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T2.review FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.city = 'santa cruz' AND T1.street_name = 'ocean st'",
"index": 876,
"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 geographic (\n city text, -- example: ['santa cruz', 'alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['santa cruz', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['santa cruz', 'ocean st', 'ocean', 'cruz', 'st.', 'st']\n city text, -- example: ['santa cruz', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOcean St. refers to street_name = 'ocean st'; Santa Cruz refers to city = 'santa cruz'\nGive the review of the restaurant located in Ocean St., Santa Cruz.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['castro st.', 'castro st', 'castro', 'st.', 'st', 'church st']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['indian', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nindian restaurant refers to food_type = 'indian'; Castro St. refers to street_name = 'castro st'; Mountainview refers to city = 'mountainview'; have the word \"Indian\" in label refers to label = 'indian'\nAmong all indian restaurants in Castro St., Mountainview, how many of them is about cookhouse in their label?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.id_restaurant) FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.street_name = 'castro st' AND T1.city = 'mountain view' AND T2.food_type = 'indian' AND T2.label LIKE '%cookhouse%'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT COUNT(T1.id_restaurant) FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.street_name = 'castro st' AND T1.city = 'mountain view' AND T2.food_type = 'indian' AND T2.label LIKE '%cookhouse%'",
"index": 877,
"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 geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['castro st.', 'castro st', 'castro', 'st.', 'st', 'church st']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['indian', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nindian restaurant refers to food_type = 'indian'; Castro St. refers to street_name = 'castro st'; Mountainview refers to city = 'mountainview'; have the word \"Indian\" in label refers to label = 'indian'\nAmong all indian restaurants in Castro St., Mountainview, how many of them is about cookhouse in their label?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreview of 2 refers to review = 2; street number below 500 refers to street_num < 500\nIn restaurants with a review of 2, how many restaurants have a street number below 500?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.id_restaurant) FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.review = 2 AND T1.street_num < 500",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT COUNT(T1.id_restaurant) FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.review = 2 AND T1.street_num < 500",
"index": 878,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreview of 2 refers to review = 2; street number below 500 refers to street_num < 500\nIn restaurants with a review of 2, how many restaurants have a street number below 500?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['asian restaurant', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['asian', '24 hour diner', 'afghani']\n city text, -- example: ['milpitas', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['n milpitas blvd', 'blvd.', 'blvd', 'church st', 'el camino real']\n city text, -- example: ['milpitas', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['milpitas', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nasian restaurant refers to food_type = 'asian'; N. Milpitas Blvd. refers to street_name = 'n milpitas blvd'; Milpitas refers to city = 'milpitas'; restaurant ID greater than 385 refers to id_restaurant > 385\nAmong all asian restaurants in N. Milpitas Blvd., Milpitas, how many of them have restaurant ID greater than 385?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.id_restaurant) AS num FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.city = 'milpitas' AND T2.food_type = 'asian' AND T1.street_name = 'n milpitas blvd' AND T1.id_restaurant > 385",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT COUNT(T1.id_restaurant) AS num FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.city = 'milpitas' AND T2.food_type = 'asian' AND T1.street_name = 'n milpitas blvd' AND T1.id_restaurant > 385",
"index": 879,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['asian restaurant', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['asian', '24 hour diner', 'afghani']\n city text, -- example: ['milpitas', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['n milpitas blvd', 'blvd.', 'blvd', 'church st', 'el camino real']\n city text, -- example: ['milpitas', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['milpitas', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nasian restaurant refers to food_type = 'asian'; N. Milpitas Blvd. refers to street_name = 'n milpitas blvd'; Milpitas refers to city = 'milpitas'; restaurant ID greater than 385 refers to id_restaurant > 385\nAmong all asian restaurants in N. Milpitas Blvd., Milpitas, how many of them have restaurant ID greater than 385?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['sanuki restaurant', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull address refers to city, street_num, street_name; restaurant named \"Sanuki Restaurant\" refers to label = 'sanuki restaurant'\nWhat is the full address of the restaurant named \"Sanuki Restaurant\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.city, T1.street_num, T1.street_name FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.label = 'sanuki restaurant'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T2.city, T1.street_num, T1.street_name FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.label = 'sanuki restaurant'",
"index": 880,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['sanuki restaurant', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull address refers to city, street_num, street_name; restaurant named \"Sanuki Restaurant\" refers to label = 'sanuki restaurant'\nWhat is the full address of the restaurant named \"Sanuki Restaurant\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['6th st', 'st.', 'st', 'n 6th st', 'church st', 'el camino real']\n city text, -- example: ['hayward', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['hayward', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['hayward', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n22779 refers to street_num = 22779; 6th St. refers to street_name = '6th St'\nList the food type of the restaurant located in 22779 6th St., Hayward City.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.food_type FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.street_num = 22779 AND T1.street_name = '6th St' AND T2.city = 'hayward'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T2.food_type FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.street_num = 22779 AND T1.street_name = '6th St' AND T2.city = 'hayward'",
"index": 881,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['6th st', 'st.', 'st', 'n 6th st', 'church st', 'el camino real']\n city text, -- example: ['hayward', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['hayward', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['hayward', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n22779 refers to street_num = 22779; 6th St. refers to street_name = '6th St'\nList the food type of the restaurant located in 22779 6th St., Hayward City.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['american', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmerican restaurant refers to food_type = 'american'; street number greater than 2000 refers to street_num > 2000; review greater than the 70% of average review refers to review > multiply(avg(review), 0.7)\nList the restaurant's ID that has a review greater than the 70% of average review of all American restaurants with street number greater than 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 T1.id_restaurant FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.food_type = 'american' AND T1.street_num > 2000 GROUP BY T1.id_restaurant ORDER BY AVG(T2.review) * 0.7 DESC",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T1.id_restaurant FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.food_type = 'american' AND T1.street_num > 2000 GROUP BY T1.id_restaurant ORDER BY AVG(T2.review) * 0.7 DESC",
"index": 882,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['american', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmerican restaurant refers to food_type = 'american'; street number greater than 2000 refers to street_num > 2000; review greater than the 70% of average review refers to review > multiply(avg(review), 0.7)\nList the restaurant's ID that has a review greater than the 70% of average review of all American restaurants with street number greater than 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 location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['asian', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['san francisco', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\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 popular refers to max(review); Asian food refers to food_type = 'asian'; San Francisco refers to city = 'san francisco'\nWhat is the name of the most popular restaurant serving Asian foods in San Francisco?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 label FROM generalinfo WHERE food_type = 'asian' AND city = 'san francisco' AND review = ( SELECT MAX(review) FROM generalinfo WHERE food_type = 'asian' AND city = 'san francisco' )",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT label FROM generalinfo WHERE food_type = 'asian' AND city = 'san francisco' AND review = ( SELECT MAX(review) FROM generalinfo WHERE food_type = 'asian' AND city = 'san francisco' )",
"index": 883,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['asian', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['san francisco', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\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 popular refers to max(review); Asian food refers to food_type = 'asian'; San Francisco refers to city = 'san francisco'\nWhat is the name of the most popular restaurant serving Asian foods in San Francisco?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 geographic (\n city text, -- example: ['monterey', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['monterey', 'bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['monterey', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['monterey', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMonterey refers to region = 'monterey'\nHow many cities are there in Monterey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 city) FROM geographic WHERE region = 'monterey'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT city) FROM geographic WHERE region = 'monterey'",
"index": 884,
"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 geographic (\n city text, -- example: ['monterey', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['monterey', 'bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['monterey', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['monterey', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMonterey refers to region = 'monterey'\nHow many cities are there in Monterey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['deli', '24 hour diner', 'afghani']\n city text, -- example: ['belmont', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['belmont', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['belmont', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndeli ris a food type; Belmont refers to city = 'belmont'; review rating of 2 or more refers to review > 2\nHow many deli in Belmont have a review rating of 2 or more?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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(id_restaurant) FROM generalinfo WHERE city = 'belmont' AND review > 2 AND food_type = 'deli'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT COUNT(id_restaurant) FROM generalinfo WHERE city = 'belmont' AND review > 2 AND food_type = 'deli'",
"index": 885,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n food_type text, -- example: ['deli', '24 hour diner', 'afghani']\n city text, -- example: ['belmont', 'san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['belmont', 'alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['belmont', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndeli ris a food type; Belmont refers to city = 'belmont'; review rating of 2 or more refers to review > 2\nHow many deli in Belmont have a review rating of 2 or more?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['concord', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['concord', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['concord', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nConcord refers to city = 'concord'\nHow many restaurants can you find in Concord?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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(id_restaurant) FROM location WHERE city = 'concord'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT COUNT(id_restaurant) FROM location WHERE city = 'concord'",
"index": 886,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['concord', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n city text, -- example: ['concord', 'san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['concord', 'alameda', 'alamo']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nConcord refers to city = 'concord'\nHow many restaurants can you find in Concord?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe top 4 most popular restaurant refers to top 4 max(review)\nIn which region can you find the top 4 most popular restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.region FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city ORDER BY T1.review DESC LIMIT 4",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T2.region FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city ORDER BY T1.review DESC LIMIT 4",
"index": 887,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe top 4 most popular restaurant refers to top 4 max(review)\nIn which region can you find the top 4 most popular restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['indian', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['los angeles area', 'bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndian restaurant refers to food_type = 'indian'; the Los Angeles area refers to region = 'los angeles area'\nHow many Indian restaurants are there in the Los Angeles area?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.city) FROM geographic AS T1 INNER JOIN generalinfo AS T2 ON T1.city = T2.city WHERE T2.food_type = 'indian' AND T1.region = 'los angeles area'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT COUNT(T1.city) FROM geographic AS T1 INNER JOIN generalinfo AS T2 ON T1.city = T2.city WHERE T2.food_type = 'indian' AND T1.region = 'los angeles area'",
"index": 888,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['indian', '24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['los angeles area', 'bay area', 'napa valley']\n PRIMARY KEY (city)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndian restaurant refers to food_type = 'indian'; the Los Angeles area refers to region = 'los angeles area'\nHow many Indian restaurants are there in the Los Angeles area?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['baskin robbins', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\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 refers to max(count(city)); Baskin Robbins restaurant refers to label = 'baskin robbins'\nIn which region can you find the highest number of Baskin Robbins restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.region AS num FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.label = 'baskin robbins' GROUP BY T2.region ORDER BY COUNT(T1.city) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T2.region AS num FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.label = 'baskin robbins' GROUP BY T2.region ORDER BY COUNT(T1.city) DESC LIMIT 1",
"index": 889,
"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 location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: ['baskin robbins', \"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\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 refers to max(count(city)); Baskin Robbins restaurant refers to label = 'baskin robbins'\nIn which region can you find the highest number of Baskin Robbins restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['yosemite and mono lake area', 'bay area', 'napa valley']\n PRIMARY KEY (city)\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 types of restaurants are there in the Yosemite and Mono Lake area?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.food_type) FROM geographic AS T1 INNER JOIN generalinfo AS T2 ON T1.city = T2.city WHERE T1.region = 'yosemite and mono lake area'",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT COUNT(T2.food_type) FROM geographic AS T1 INNER JOIN generalinfo AS T2 ON T1.city = T2.city WHERE T1.region = 'yosemite and mono lake area'",
"index": 890,
"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 generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n review real, -- example: [2.3, 3.8]\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE geographic (\n city text, -- example: ['alameda', 'alamo']\n county text, -- country, example: ['alameda county', 'contra costa county']\n region text, -- example: ['yosemite and mono lake area', 'bay area', 'napa valley']\n PRIMARY KEY (city)\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 types of restaurants are there in the Yosemite and Mono Lake area?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\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 refers to max(count(id_restaurant))\nWhich region has the highest number of restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.region FROM geographic AS T1 INNER JOIN location AS T2 ON T1.city = T2.city GROUP BY T1.region ORDER BY COUNT(T2.id_restaurant) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "restaurant.sqlite",
"gt_sql": "SELECT T1.region FROM geographic AS T1 INNER JOIN location AS T2 ON T1.city = T2.city GROUP BY T1.region ORDER BY COUNT(T2.id_restaurant) DESC LIMIT 1",
"index": 891,
"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 geographic (\n city text, -- example: ['alameda', 'alamo']\n region text, -- example: ['bay area', 'napa valley']\n PRIMARY KEY (city)\n);\n\nCREATE TABLE generalinfo (\n id_restaurant integer, -- example: [1, 2]\n label text, -- example: [\"sparky's diner\", 'kabul afghan cuisine']\n food_type text, -- example: ['24 hour diner', 'afghani']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_generalinfo_city FOREIGN KEY (city) REFERENCES geographic (city)\n);\n\nCREATE TABLE location (\n id_restaurant integer, -- example: [1, 2]\n street_num integer, -- street number, example: [242, 135]\n street_name text, -- example: ['church st', 'el camino real']\n city text, -- example: ['san francisco', 'san carlos']\n PRIMARY KEY (id_restaurant),\n CONSTRAINT fk_location_id_restaurant FOREIGN KEY (id_restaurant) REFERENCES generalinfo (id_restaurant),\n CONSTRAINT fk_location_city FOREIGN KEY (city) REFERENCES geographic (city)\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 refers to max(count(id_restaurant))\nWhich region has the highest number of restaurants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 Season (\n Season_Id integer, -- example: [1, 2]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn after the year 1985 refers to SUBSTR(DOB, 1, 4) > 1985\nHow many players were born after the year 1985?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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(Player_Id) FROM Player WHERE SUBSTR(DOB, 1, 4) > 1985",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(Player_Id) FROM Player WHERE SUBSTR(DOB, 1, 4) > 1985",
"index": 892,
"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 Season (\n Season_Id integer, -- example: [1, 2]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn after the year 1985 refers to SUBSTR(DOB, 1, 4) > 1985\nHow many players were born after the year 1985?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin May 2008 refers to SUBSTR(Match_Date, 1, 4) = '2008' AND SUBSTR(Match_Date, 7, 1) = '5'\nHow many matches were there in May, 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(Match_Id) FROM `Match` WHERE SUBSTR(Match_Date, 1, 4) = '2008' AND SUBSTR(Match_Date, 7, 1) = '5'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(Match_Id) FROM `Match` WHERE SUBSTR(Match_Date, 1, 4) = '2008' AND SUBSTR(Match_Date, 7, 1) = '5'",
"index": 893,
"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 Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin May 2008 refers to SUBSTR(Match_Date, 1, 4) = '2008' AND SUBSTR(Match_Date, 7, 1) = '5'\nHow many matches were there in May, 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 Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayer no.41 won the \"man of the match\" refers to Man_of_the_Match = 41\nFor how many times has player no.41 won the \"man of the match\" 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(Match_Id) FROM `Match` WHERE Man_of_the_Match = 41",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(Match_Id) FROM `Match` WHERE Man_of_the_Match = 41",
"index": 894,
"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 Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayer no.41 won the \"man of the match\" refers to Man_of_the_Match = 41\nFor how many times has player no.41 won the \"man of the match\" 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 Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['Australia', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAustralia refers to Country_Name = 'Australia'\nHow many players are from Australia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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(CASE WHEN T2.Country_Name = 'Australia' THEN T1.Player_Id ELSE NULL END) FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_Id",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(CASE WHEN T2.Country_Name = 'Australia' THEN T1.Player_Id ELSE NULL END) FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_Id",
"index": 895,
"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 Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['Australia', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAustralia refers to Country_Name = 'Australia'\nHow many players are from Australia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry refers to Country_Name; the oldest refers to min(DOB)\nWhich country is the oldest player from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.Country_Name FROM Country AS T1 INNER JOIN Player AS T2 ON T2.Country_Name = T1.Country_Id WHERE T2.Country_Name IS NOT NULL ORDER BY T2.DOB LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Country_Name FROM Country AS T1 INNER JOIN Player AS T2 ON T2.Country_Name = T1.Country_Id WHERE T2.Country_Name IS NOT NULL ORDER BY T2.DOB LIMIT 1",
"index": 896,
"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 Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry refers to Country_Name; the oldest refers to min(DOB)\nWhich country is the oldest player from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSC Ganguly refers to Player_Name = 'SC Ganguly'\nWhat is the bowling skill of SC Ganguly?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.Bowling_Skill FROM Bowling_Style AS T1 INNER JOIN Player AS T2 ON T2.Bowling_skill = T1.Bowling_Id WHERE T2.Player_Name = 'SC Ganguly'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Bowling_Skill FROM Bowling_Style AS T1 INNER JOIN Player AS T2 ON T2.Bowling_skill = T1.Bowling_Id WHERE T2.Player_Name = 'SC Ganguly'",
"index": 897,
"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 Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSC Ganguly refers to Player_Name = 'SC Ganguly'\nWhat is the bowling skill of SC Ganguly?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['Australia', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAustralia refers to Country_Name = 'Australia'\nPlease list the bowling skills of all the players from Australia.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.Bowling_Skill FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T1.Bowling_skill = T2.Bowling_Id INNER JOIN Country AS T3 ON T1.Country_Name = T3.Country_Id WHERE T3.Country_Name = 'Australia' GROUP BY T2.Bowling_Skill",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Bowling_Skill FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T1.Bowling_skill = T2.Bowling_Id INNER JOIN Country AS T3 ON T1.Country_Name = T3.Country_Id WHERE T3.Country_Name = 'Australia' GROUP BY T2.Bowling_Skill",
"index": 898,
"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 Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['Australia', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAustralia refers to Country_Name = 'Australia'\nPlease list the bowling skills of all the players from Australia.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Legbreak', 'Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe oldest refers to min(DOB); date of birth refers to DOB\nAmong the players whose bowling skill is \"Legbreak\", when was the oldest one of them born?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 MIN(T1.DOB) FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T1.Bowling_skill = T2.Bowling_Id WHERE T2.Bowling_Skill = 'Legbreak'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT MIN(T1.DOB) FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T1.Bowling_skill = T2.Bowling_Id WHERE T2.Bowling_Skill = 'Legbreak'",
"index": 899,
"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 Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Legbreak', 'Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe oldest refers to min(DOB); date of birth refers to DOB\nAmong the players whose bowling skill is \"Legbreak\", when was the oldest one of them born?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.