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 geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n FirstBrewedYear integer, -- example: [1919, 1926]\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n State text, -- example: ['CA']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['Sac State American River Courtyard', 'LOST']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = MULTIPLY(DIVIDE(SUM(LocationName = 'Sac State American River Courtyard'), COUNT(LocationID)), 1.0); Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard';\nCalculate the percentage of sales done at Sac State American River Courtyard.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T2.LocationName = 'Sac State American River Courtyard' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.TransactionID) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T2.LocationName = 'Sac State American River Courtyard' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.TransactionID) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID",
"index": 2600,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n FirstBrewedYear integer, -- example: [1919, 1926]\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n State text, -- example: ['CA']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['Sac State American River Courtyard', 'LOST']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = MULTIPLY(DIVIDE(SUM(LocationName = 'Sac State American River Courtyard'), COUNT(LocationID)), 1.0); Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard';\nCalculate the percentage of sales done at Sac State American River Courtyard.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n SubscribedToEmailList text, -- example: ['TRUE', 'FALSE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n Caffeinated text, -- example: ['TRUE', 'FALSE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage = DIVIDE(COUNT(RootBeerID WHERE Caffeinated = 'TRUE'), COUNT(PurchaseDate)); caffeinated refers to Caffeinated = 'TRUE';\nOn average how many caffeinated root beers are sold a day?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T2.RootBeerID) AS REAL) / COUNT(DISTINCT T2.PurchaseDate) FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID INNER JOIN `transaction` AS T3 ON T2.RootBeerID = T3.RootBeerID WHERE T1.Caffeinated = 'TRUE'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT CAST(COUNT(T2.RootBeerID) AS REAL) / COUNT(DISTINCT T2.PurchaseDate) FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID INNER JOIN `transaction` AS T3 ON T2.RootBeerID = T3.RootBeerID WHERE T1.Caffeinated = 'TRUE'",
"index": 2601,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n SubscribedToEmailList text, -- example: ['TRUE', 'FALSE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n Caffeinated text, -- example: ['TRUE', 'FALSE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage = DIVIDE(COUNT(RootBeerID WHERE Caffeinated = 'TRUE'), COUNT(PurchaseDate)); caffeinated refers to Caffeinated = 'TRUE';\nOn average how many caffeinated root beers are sold a day?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost amount of profit per unit refers to MAX(SUBTRACT(CurrentRetailPrice, WholesaleCost)); least amount of profit per unit refers to MIN(SUBTRACT(CurrentRetailPrice, WholesaleCost));\nFind the root beer with the most and least amount of profit per unit and list the container types in which these root beers are sold.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT * FROM ( SELECT T1.BrandName, T2.ContainerType FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID ORDER BY T1.CurrentRetailPrice - T1.WholesaleCost DESC LIMIT 1 ) UNION ALL SELECT * FROM ( SELECT T3.BrandName, T4.ContainerType FROM rootbeerbrand AS T3 INNER JOIN rootbeer AS T4 ON T3.BrandID = T4.BrandID ORDER BY T3.CurrentRetailPrice - T3.WholesaleCost ASC LIMIT 1 )",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT * FROM ( SELECT T1.BrandName, T2.ContainerType FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID ORDER BY T1.CurrentRetailPrice - T1.WholesaleCost DESC LIMIT 1 ) UNION ALL SELECT * FROM ( SELECT T3.BrandName, T4.ContainerType FROM rootbeerbrand AS T3 INNER JOIN rootbeer AS T4 ON T3.BrandID = T4.BrandID ORDER BY T3.CurrentRetailPrice - T3.WholesaleCost ASC LIMIT 1 )",
"index": 2602,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost amount of profit per unit refers to MAX(SUBTRACT(CurrentRetailPrice, WholesaleCost)); least amount of profit per unit refers to MIN(SUBTRACT(CurrentRetailPrice, WholesaleCost));\nFind the root beer with the most and least amount of profit per unit and list the container types in which these root beers are sold.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage cost = DIVIDE(SUM(PurchasePrice > 2), COUNT(RootBeerID) WHERE PurchasePrice > 2); more than 2 dollars refers to PurchasePrice > 2; in bottles refers to ContainerType = 'Bottle';\nWhat is the average cost of root beers purchased for more than 2 dollars and sold in bottles?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(T2.PurchasePrice) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T1.ContainerType = 'Bottle' AND T2.PurchasePrice > 2",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT AVG(T2.PurchasePrice) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T1.ContainerType = 'Bottle' AND T2.PurchasePrice > 2",
"index": 2603,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage cost = DIVIDE(SUM(PurchasePrice > 2), COUNT(RootBeerID) WHERE PurchasePrice > 2); more than 2 dollars refers to PurchasePrice > 2; in bottles refers to ContainerType = 'Bottle';\nWhat is the average cost of root beers purchased for more than 2 dollars and sold in bottles?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost five stars refers to MAX(COUNT(StarRating = 5)); in 2012 refers to FirstBrewedYear = 2012;\nWhich root beer got the most five stars in 2012? Give the brand name of this beer.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.StarRating = 5 AND strftime('%Y', T2.ReviewDate) = '2012' GROUP BY T1.BrandID ORDER BY COUNT(T2.BrandID) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T3.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.StarRating = 5 AND strftime('%Y', T2.ReviewDate) = '2012' GROUP BY T1.BrandID ORDER BY COUNT(T2.BrandID) DESC LIMIT 1",
"index": 2604,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost five stars refers to MAX(COUNT(StarRating = 5)); in 2012 refers to FirstBrewedYear = 2012;\nWhich root beer got the most five stars in 2012? Give the brand name of this beer.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Don', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['FALSE', 'TRUE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['FALSE', 'TRUE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndifference in the average = SUBTRACT(DIVIDE(MULTIPLY(SUM(Honey = 'TRUE'), 1.0), COUNT(TransactionDate)), DIVIDE(MULTIPLY(SUM(Honey = 'FALSE'), 1.0), COUNT(TransactionDate))); contain honey refers to Honey = 'TRUE'; don’t contain honey refers to Honey = 'FALSE'\nWhat is the difference in the average number of sales per day of root beer brands that contain honey and that don’t contain honey.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT (CAST(SUM(CASE WHEN T1.Honey = 'TRUE' THEN 1 ELSE 0 END) AS REAL) / COUNT(DISTINCT T3.TransactionDate)) - (CAST(SUM(CASE WHEN T1.Honey <> 'TRUE' THEN 1 ELSE 0 END) AS REAL) / COUNT(DISTINCT T3.TransactionDate)) FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID INNER JOIN `transaction` AS T3 ON T2.RootBeerID = T3.RootBeerID",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT (CAST(SUM(CASE WHEN T1.Honey = 'TRUE' THEN 1 ELSE 0 END) AS REAL) / COUNT(DISTINCT T3.TransactionDate)) - (CAST(SUM(CASE WHEN T1.Honey <> 'TRUE' THEN 1 ELSE 0 END) AS REAL) / COUNT(DISTINCT T3.TransactionDate)) FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID INNER JOIN `transaction` AS T3 ON T2.RootBeerID = T3.RootBeerID",
"index": 2605,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Don', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['FALSE', 'TRUE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['FALSE', 'TRUE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndifference in the average = SUBTRACT(DIVIDE(MULTIPLY(SUM(Honey = 'TRUE'), 1.0), COUNT(TransactionDate)), DIVIDE(MULTIPLY(SUM(Honey = 'FALSE'), 1.0), COUNT(TransactionDate))); contain honey refers to Honey = 'TRUE'; don’t contain honey refers to Honey = 'FALSE'\nWhat is the difference in the average number of sales per day of root beer brands that contain honey and that don’t contain honey.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n Country text, -- example: ['United States', 'Australia']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n Last text, -- last name, example: ['Walton', 'Jones']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSeptember 2014 refers to ReviewDate LIKE '2014-09%'; brand of beers refers to BrandName; highest star ratings refers to MAX(StarRating);\nIn the reviews of September 2014. Which brand of beers obtained the highest star ratings?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5 AND T2.ReviewDate BETWEEN '2014-09-01' AND '2014-09-30'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT DISTINCT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5 AND T2.ReviewDate BETWEEN '2014-09-01' AND '2014-09-30'",
"index": 2606,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n Country text, -- example: ['United States', 'Australia']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n Last text, -- last name, example: ['Walton', 'Jones']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSeptember 2014 refers to ReviewDate LIKE '2014-09%'; brand of beers refers to BrandName; highest star ratings refers to MAX(StarRating);\nIn the reviews of September 2014. Which brand of beers obtained the highest star ratings?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['American Express', 'Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n City text, -- example: ['Sacramento']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprecise location refers to Latitude, Longitude; American Express refers to CreditCardType = 'American Express';\nWhat is the precise location of all paying customers with American Express?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Latitude, T2.Longitude FROM `transaction` AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID WHERE T1.CreditCardType = 'American Express'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT DISTINCT T2.Latitude, T2.Longitude FROM `transaction` AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID WHERE T1.CreditCardType = 'American Express'",
"index": 2607,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['American Express', 'Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n City text, -- example: ['Sacramento']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprecise location refers to Latitude, Longitude; American Express refers to CreditCardType = 'American Express';\nWhat is the precise location of all paying customers with American Express?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Visa', 'Discover']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n Country text, -- example: ['United States', 'Australia']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n City text, -- example: ['Folsom', 'Sacramento', 'Orangevale']\n ZipCode integer, -- example: [94256, 94258]\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFolsom refers to City = 'Folsom'; Visa refers to CreditCardType = 'Visa';\nHow many Folsom customers prefer to pay with Visa?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.City = 'Folsom' AND T2.CreditCardType = 'Visa'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.City = 'Folsom' AND T2.CreditCardType = 'Visa'",
"index": 2608,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Visa', 'Discover']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n Country text, -- example: ['United States', 'Australia']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n City text, -- example: ['Folsom', 'Sacramento', 'Orangevale']\n ZipCode integer, -- example: [94256, 94258]\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFolsom refers to City = 'Folsom'; Visa refers to CreditCardType = 'Visa';\nHow many Folsom customers prefer to pay with Visa?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n City text, -- example: ['Sacramento']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n5 stars refers to StarRating = 5; in November 2012 refers to ReviewDate LIKE '2012-11%';\nFrom which cities are the customers who gave 5 stars in their reviews in November 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.City FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating = 5 AND T2.ReviewDate BETWEEN '2012-11-01' AND '2012-11-30'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT DISTINCT T1.City FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating = 5 AND T2.ReviewDate BETWEEN '2012-11-01' AND '2012-11-30'",
"index": 2609,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n City text, -- example: ['Sacramento']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n5 stars refers to StarRating = 5; in November 2012 refers to ReviewDate LIKE '2012-11%';\nFrom which cities are the customers who gave 5 stars in their reviews in November 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Peg', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Winchester', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbrands of beer refers to BrandName;\nWhat brands of beer has Peg Winchester consumed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.BrandName FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeerbrand AS T3 ON T2.BrandID = T3.BrandID WHERE T1.First = 'Peg' AND T1.Last = 'Winchester'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T3.BrandName FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeerbrand AS T3 ON T2.BrandID = T3.BrandID WHERE T1.First = 'Peg' AND T1.Last = 'Winchester'",
"index": 2610,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Peg', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Winchester', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbrands of beer refers to BrandName;\nWhat brands of beer has Peg Winchester consumed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['Thomas Kemper', 'A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n Last text, -- last name, example: ['Thomas', 'Walton', 'Jones']\n State text, -- example: ['CA']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n City text, -- example: ['Sacramento']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThomas Kemper refers to BrandName = 'Thomas Kemper'; latitude the beer is consumed the most refers to MAX(COUNT(Latitude));\nAt what latitude is the Thomas Kemper brand beer consumed the most?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Latitude FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID INNER JOIN geolocation AS T3 ON T1.LocationID = T3.LocationID WHERE T2.BrandName = 'Thomas Kemper' GROUP BY T3.Latitude ORDER BY COUNT(T1.BrandID) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T3.Latitude FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID INNER JOIN geolocation AS T3 ON T1.LocationID = T3.LocationID WHERE T2.BrandName = 'Thomas Kemper' GROUP BY T3.Latitude ORDER BY COUNT(T1.BrandID) DESC LIMIT 1",
"index": 2611,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['Thomas Kemper', 'A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n Last text, -- last name, example: ['Thomas', 'Walton', 'Jones']\n State text, -- example: ['CA']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n City text, -- example: ['Sacramento']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThomas Kemper refers to BrandName = 'Thomas Kemper'; latitude the beer is consumed the most refers to MAX(COUNT(Latitude));\nAt what latitude is the Thomas Kemper brand beer consumed the most?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n ZipCode integer, -- example: [94256, 94258]\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n Honey text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprecise location = Latitude, Longitude;\nWhat is the precise location of zip code 95819?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Latitude, T2.Longitude FROM location AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID WHERE T1.ZipCode = 95819",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T2.Latitude, T2.Longitude FROM location AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID WHERE T1.ZipCode = 95819",
"index": 2612,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n ZipCode integer, -- example: [94256, 94258]\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n Honey text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprecise location = Latitude, Longitude;\nWhat is the precise location of zip code 95819?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoordinates 38,566,129, -121,426,432 refers to Latitude = 38.566129 AND Longitude = -121.426432;\nWhat brands of beers are manufactured at coordinates 38,566,129, -121,426,432?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID INNER JOIN geolocation AS T3 ON T1.LocationID = T3.LocationID WHERE T3.Latitude = '38.566129' AND T3.Longitude = '-121.426432'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT DISTINCT T2.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID INNER JOIN geolocation AS T3 ON T1.LocationID = T3.LocationID WHERE T3.Latitude = '38.566129' AND T3.Longitude = '-121.426432'",
"index": 2613,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoordinates 38,566,129, -121,426,432 refers to Latitude = 38.566129 AND Longitude = -121.426432;\nWhat brands of beers are manufactured at coordinates 38,566,129, -121,426,432?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstar rating is more than 3 refers to StarRating > 3;\nList the brand IDs of the beers whose star rating is more than 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 BrandID FROM rootbeerreview WHERE StarRating > 3",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT BrandID FROM rootbeerreview WHERE StarRating > 3",
"index": 2614,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstar rating is more than 3 refers to StarRating > 3;\nList the brand IDs of the beers whose star rating is more than 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 geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-04-23', '2015-10-26', '2015-10-23', '2015-04-26', '2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbottle root beer refers to ContainerType = 'Bottle'; purchased between 4/3/2015 and 10/26/2015 refers to PurchaseDate BETWEEN '2015-04-23' AND '2015-10-26';\nHow many brands of bottle root beer were purchased between 4/3/2015 and 10/26/2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(BrandID) FROM rootbeer WHERE ContainerType = 'Bottle' AND PurchaseDate BETWEEN '2015-04-03' AND '2015-10-26'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(BrandID) FROM rootbeer WHERE ContainerType = 'Bottle' AND PurchaseDate BETWEEN '2015-04-03' AND '2015-10-26'",
"index": 2615,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-04-23', '2015-10-26', '2015-10-23', '2015-04-26', '2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbottle root beer refers to ContainerType = 'Bottle'; purchased between 4/3/2015 and 10/26/2015 refers to PurchaseDate BETWEEN '2015-04-23' AND '2015-10-26';\nHow many brands of bottle root beer were purchased between 4/3/2015 and 10/26/2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = First, Last; 5-star rating refers to StarRating = 5; commented \"The quintessential dessert root beer. No ice cream required\" refers to Review = 'The quintessential dessert root beer. No ice cream required.';\nWhat is the full name of the customer who gave a 5-star rating and commented \"The quintessential dessert root beer. No ice cream required\" on his review?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating = 5 AND T2.Review = 'The quintessential dessert root beer. No ice cream required.'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating = 5 AND T2.Review = 'The quintessential dessert root beer. No ice cream required.'",
"index": 2616,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = First, Last; 5-star rating refers to StarRating = 5; commented \"The quintessential dessert root beer. No ice cream required\" refers to Review = 'The quintessential dessert root beer. No ice cream required.';\nWhat is the full name of the customer who gave a 5-star rating and commented \"The quintessential dessert root beer. No ice cream required\" on his 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 rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Sacramento', 'Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nemail addresses refers to Email; Sacramento refers to City = 'Sacramento'; star rating of more than 3 refers to StarRating > 3; in 2014 refers to ReviewDate LIKE '2014%';\nTally the email addresses and phone numbers of customers from Sacramento who gave a star rating of more than 3 in 2014.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Email, T1.PhoneNumber FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating > 3 AND T1.City = 'Sacramento' AND T2.ReviewDate BETWEEN '2014-01-01' AND '2014-12-31'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT DISTINCT T1.Email, T1.PhoneNumber FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating > 3 AND T1.City = 'Sacramento' AND T2.ReviewDate BETWEEN '2014-01-01' AND '2014-12-31'",
"index": 2617,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Sacramento', 'Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nemail addresses refers to Email; Sacramento refers to City = 'Sacramento'; star rating of more than 3 refers to StarRating > 3; in 2014 refers to ReviewDate LIKE '2014%';\nTally the email addresses and phone numbers of customers from Sacramento who gave a star rating of more than 3 in 2014.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Sacramento', 'Lodi', 'Fall River']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n City text, -- example: ['Sacramento']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2016-01-03', '2016-01-01', '2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n City text, -- example: ['Sacramento', 'Elk Grove', 'Orangevale']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n SubscribedToEmailList text, -- example: ['TRUE', 'FALSE']\n Gender text, -- example: ['F', 'M']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale refers to Gender = 'F'; mailing list subscribers refers to SubscribedToEmailList = 'TRUE'; Elk Grove refers to City = 'Sacramento'; 4-star rating refers to StarRating = 4; between 1/3/2016 and 10/26/2016 refers to ReviewDate BETWEEN '2016-01-03' AND '2016-10-26';\nHow many female mailing list subscribers from Sacramento gave a 4-star rating between 1/3/2016 and 10/26/2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CustomerID) FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating = 4 AND T1.City = 'Sacramento' AND T1.Gender = 'F' AND T1.SubscribedToEmailList = 'TRUE' AND T2.ReviewDate BETWEEN '2013-01-03' AND '2013-10-26'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating = 4 AND T1.City = 'Sacramento' AND T1.Gender = 'F' AND T1.SubscribedToEmailList = 'TRUE' AND T2.ReviewDate BETWEEN '2013-01-03' AND '2013-10-26'",
"index": 2618,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Sacramento', 'Lodi', 'Fall River']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n City text, -- example: ['Sacramento']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2016-01-03', '2016-01-01', '2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n City text, -- example: ['Sacramento', 'Elk Grove', 'Orangevale']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n SubscribedToEmailList text, -- example: ['TRUE', 'FALSE']\n Gender text, -- example: ['F', 'M']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale refers to Gender = 'F'; mailing list subscribers refers to SubscribedToEmailList = 'TRUE'; Elk Grove refers to City = 'Sacramento'; 4-star rating refers to StarRating = 4; between 1/3/2016 and 10/26/2016 refers to ReviewDate BETWEEN '2016-01-03' AND '2016-10-26';\nHow many female mailing list subscribers from Sacramento gave a 4-star rating between 1/3/2016 and 10/26/2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbottled root beer refers to ContainerType = 'Bottle'; first brewing year is no later than 1930 refers to FirstBrewedYear < 1930;\nList the brand names of bottled root beer whose first brewing year is no later than 1930.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T2.FirstBrewedYear < '1930-01-01' AND T1.ContainerType = 'Bottle' ORDER BY T2.FirstBrewedYear LIMIT 1",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T2.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T2.FirstBrewedYear < '1930-01-01' AND T1.ContainerType = 'Bottle' ORDER BY T2.FirstBrewedYear LIMIT 1",
"index": 2619,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbottled root beer refers to ContainerType = 'Bottle'; first brewing year is no later than 1930 refers to FirstBrewedYear < 1930;\nList the brand names of bottled root beer whose first brewing year is no later than 1930.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['Sac State American River Courtyard', 'LOST']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2015-11-27', '2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Visa', 'Discover']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal purchases = SUM(PurchasePrice); Visa credit card refers to CreditCardType = 'Visa'; Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard'; between 6/3/2014 and 11/27/2015 refers to TransactionDate BETWEEN '2014-06-03' AND '2015-11-27';\nCalculate the total purchases made by customers using their Visa credit cards in the Sac State American River Courtyard between 6/3/2014 and 11/27/2015.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T1.PurchasePrice) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State American River Courtyard' AND T1.CreditCardType = 'Visa' AND T1.TransactionDate BETWEEN '2014-06-03' AND '2015-11-27'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT SUM(T1.PurchasePrice) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State American River Courtyard' AND T1.CreditCardType = 'Visa' AND T1.TransactionDate BETWEEN '2014-06-03' AND '2015-11-27'",
"index": 2620,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['Sac State American River Courtyard', 'LOST']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2015-11-27', '2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Visa', 'Discover']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal purchases = SUM(PurchasePrice); Visa credit card refers to CreditCardType = 'Visa'; Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard'; between 6/3/2014 and 11/27/2015 refers to TransactionDate BETWEEN '2014-06-03' AND '2015-11-27';\nCalculate the total purchases made by customers using their Visa credit cards in the Sac State American River Courtyard between 6/3/2014 and 11/27/2015.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nWhat is the credit card type used by Kenneth Walton?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CreditCardType FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Kenneth' AND T1.Last = 'Walton'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT DISTINCT T2.CreditCardType FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Kenneth' AND T1.Last = 'Walton'",
"index": 2621,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nWhat is the credit card type used by Kenneth Walton?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n City text, -- example: ['Lodi', 'Fall River']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Dawn', 'Tim', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Childress', 'Ocel', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n ZipCode integer, -- example: [94256, 94258]\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nList out the root beers bought by Tim Ocel and Dawn Childress.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.RootBeerID FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T2.CustomerID = T1.CustomerID WHERE (T1.First = 'Tim' AND T1.Last = 'Ocel') OR (T1.First = 'Dawn' AND T1.Last = 'Childress')",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T2.RootBeerID FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T2.CustomerID = T1.CustomerID WHERE (T1.First = 'Tim' AND T1.Last = 'Ocel') OR (T1.First = 'Dawn' AND T1.Last = 'Childress')",
"index": 2622,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n City text, -- example: ['Lodi', 'Fall River']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Dawn', 'Tim', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Childress', 'Ocel', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n ZipCode integer, -- example: [94256, 94258]\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nList out the root beers bought by Tim Ocel and Dawn Childress.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Jim', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Breech', 'Jim', 'Walton', 'Jones']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n City text, -- example: ['Lodi', 'Fall River']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbottles refers to ContainerType = 'Bottle';\nHow many bottles of beer have been bought by Jim Breech?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T3.ContainerType) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T2.CustomerID = T1.CustomerID INNER JOIN rootbeer AS T3 ON T3.RootBeerID = T2.RootBeerID WHERE T3.ContainerType = 'Bottle' AND T1.First = 'Jim' AND T1.Last = 'Breech'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(T3.ContainerType) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T2.CustomerID = T1.CustomerID INNER JOIN rootbeer AS T3 ON T3.RootBeerID = T2.RootBeerID WHERE T3.ContainerType = 'Bottle' AND T1.First = 'Jim' AND T1.Last = 'Breech'",
"index": 2623,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Jim', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Breech', 'Jim', 'Walton', 'Jones']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n City text, -- example: ['Lodi', 'Fall River']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbottles refers to ContainerType = 'Bottle';\nHow many bottles of beer have been bought by Jim Breech?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCalifornia refers to State = 'CA';\nHow many transactions have been made to purchase a root beer brand from 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 COUNT(T3.RootBeerID) FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID INNER JOIN `transaction` AS T3 ON T2.RootBeerID = T3.RootBeerID WHERE T1.State = 'CA'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(T3.RootBeerID) FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID INNER JOIN `transaction` AS T3 ON T2.RootBeerID = T3.RootBeerID WHERE T1.State = 'CA'",
"index": 2624,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCalifornia refers to State = 'CA';\nHow many transactions have been made to purchase a root beer brand from 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 transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntop 10 spenders refers to MAX(PurchasePrice) LIMIT 10;\nList out the name of the top 10 spenders and what credit card type are they using.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.First, T1.Last, T2.CreditCardType FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID GROUP BY T1.CustomerID ORDER BY SUM(T2.PurchasePrice) DESC LIMIT 10",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T1.First, T1.Last, T2.CreditCardType FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID GROUP BY T1.CustomerID ORDER BY SUM(T2.PurchasePrice) DESC LIMIT 10",
"index": 2625,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntop 10 spenders refers to MAX(PurchasePrice) LIMIT 10;\nList out the name of the top 10 spenders and what credit card type are they using.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nroot beer brand refers to BrandName; not caffeinated refers to Caffeinated = 'FALSE'; not containing cane sugar refers to CaneSugar = 'FALSE'; total amount sold = SUM(PurchasePrice);\nList out root beer brand that is not caffeinated and not containing cane sugar. What is the total amount sold for this products?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.BrandName, SUM(T3.PurchasePrice) FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID INNER JOIN `transaction` AS T3 ON T2.RootBeerID = T3.RootBeerID WHERE T1.CaneSugar = 'FALSE' AND T1.Caffeinated = 'FALSE' GROUP BY T1.BrandName",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T1.BrandName, SUM(T3.PurchasePrice) FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID INNER JOIN `transaction` AS T3 ON T2.RootBeerID = T3.RootBeerID WHERE T1.CaneSugar = 'FALSE' AND T1.Caffeinated = 'FALSE' GROUP BY T1.BrandName",
"index": 2626,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nroot beer brand refers to BrandName; not caffeinated refers to Caffeinated = 'FALSE'; not containing cane sugar refers to CaneSugar = 'FALSE'; total amount sold = SUM(PurchasePrice);\nList out root beer brand that is not caffeinated and not containing cane sugar. What is the total amount sold for this products?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nroot beer brand refers to BrandName; lowest purchase refers to MIN(COUNT(BrandID));\nWhich of the root beer brand have the lowest purchase?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID GROUP BY T2.BrandID ORDER BY COUNT(T1.BrandID) LIMIT 1",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T2.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID GROUP BY T2.BrandID ORDER BY COUNT(T1.BrandID) LIMIT 1",
"index": 2627,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nroot beer brand refers to BrandName; lowest purchase refers to MIN(COUNT(BrandID));\nWhich of the root beer brand have the lowest purchase?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Sellers', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbest seller root beer refers to MAX(COUNT(BrandID)); average star rating = AVG(StarRating);\nWhat is the best seller root beer brand and what is the average star rating for this root beer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.BrandID, AVG(T1.StarRating) FROM rootbeerreview AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID GROUP BY T3.BrandID ORDER BY COUNT(T1.BrandID) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T1.BrandID, AVG(T1.StarRating) FROM rootbeerreview AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID GROUP BY T3.BrandID ORDER BY COUNT(T1.BrandID) DESC LIMIT 1",
"index": 2628,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Sellers', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbest seller root beer refers to MAX(COUNT(BrandID)); average star rating = AVG(StarRating);\nWhat is the best seller root beer brand and what is the average star rating for this root beer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n Last text, -- last name, example: ['Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['River City', 'Frostie', 'A&W', 'A.J. Stephans']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage difference = (DIVIDE(MULTIPLY(SUBTRACT(SUM(PurchasePrice WHERE BrandName = 'River City'), SUM(PurchasePrice WHERE BrandName = 'Frostie')), 100), SUM(PurchasePrice WHERE BrandName = 'Frostie'))); River City refers to BrandName = 'River City'; Frostie refers to BrandName = 'Frostie';\nWhat is the percentage difference of River City sale compare to Frostie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST((SUM(CASE WHEN T3.BrandName = 'River City' THEN T2.PurchasePrice ELSE 0 END) - SUM(CASE WHEN T3.BrandName = 'Frostie' THEN T2.PurchasePrice ELSE 0 END)) AS REAL) * 100 / SUM(CASE WHEN T3.BrandName = 'Frostie' THEN T2.PurchasePrice ELSE 0 END) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT CAST((SUM(CASE WHEN T3.BrandName = 'River City' THEN T2.PurchasePrice ELSE 0 END) - SUM(CASE WHEN T3.BrandName = 'Frostie' THEN T2.PurchasePrice ELSE 0 END)) AS REAL) * 100 / SUM(CASE WHEN T3.BrandName = 'Frostie' THEN T2.PurchasePrice ELSE 0 END) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID",
"index": 2629,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n Last text, -- last name, example: ['Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['River City', 'Frostie', 'A&W', 'A.J. Stephans']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage difference = (DIVIDE(MULTIPLY(SUBTRACT(SUM(PurchasePrice WHERE BrandName = 'River City'), SUM(PurchasePrice WHERE BrandName = 'Frostie')), 100), SUM(PurchasePrice WHERE BrandName = 'Frostie'))); River City refers to BrandName = 'River City'; Frostie refers to BrandName = 'Frostie';\nWhat is the percentage difference of River City sale compare to Frostie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCalifornia refers to State = 'CA';\nPlease name all of the cities in 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 DISTINCT City FROM customers WHERE State = 'CA'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT DISTINCT City FROM customers WHERE State = 'CA'",
"index": 2630,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCalifornia refers to State = 'CA';\nPlease name all of the cities in 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 rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n State text, -- example: ['CA', 'MA']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['TRUE', 'FALSE']\n Gender text, -- example: ['F', 'M']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = MULTIPLY(DIVIDE(COUNT(CustomerID WHERE Gender = 'F'), COUNT(CustomerID) WHERE SubscribedToEmailList = 'TRUE'), 1.0); female refers to Gender = 'F'; subscribed to the email list refers to SubscribedToEmailList = 'TRUE';\nWhat is the percentage of female customers who subscribed to the email list?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Gender = 'F' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(SubscribedToEmailList) FROM customers WHERE SubscribedToEmailList = 'TRUE'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN Gender = 'F' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(SubscribedToEmailList) FROM customers WHERE SubscribedToEmailList = 'TRUE'",
"index": 2631,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n State text, -- example: ['CA', 'MA']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['TRUE', 'FALSE']\n Gender text, -- example: ['F', 'M']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = MULTIPLY(DIVIDE(COUNT(CustomerID WHERE Gender = 'F'), COUNT(CustomerID) WHERE SubscribedToEmailList = 'TRUE'), 1.0); female refers to Gender = 'F'; subscribed to the email list refers to SubscribedToEmailList = 'TRUE';\nWhat is the percentage of female customers who subscribed to the email list?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Dick', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Ruthven', 'Walton', 'Jones']\n State text, -- example: ['CA']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype of card refers to CreditCardType;\nWhich type of card did Dick Ruthven use to pay for all of his transactions?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CreditCardType FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Dick' AND T1.Last = 'Ruthven'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT DISTINCT T2.CreditCardType FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Dick' AND T1.Last = 'Ruthven'",
"index": 2632,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Dick', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Ruthven', 'Walton', 'Jones']\n State text, -- example: ['CA']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype of card refers to CreditCardType;\nWhich type of card did Dick Ruthven use to pay for all of his transactions?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n State text, -- example: ['CA', 'MA']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n State text, -- example: ['CA']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['Sac State Union', 'LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSac State Union refers to LocationName = 'Sac State Union';\nHow many transactions were made at Sac State Union?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.TransactionID) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State Union'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(T1.TransactionID) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State Union'",
"index": 2633,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n State text, -- example: ['CA', 'MA']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n State text, -- example: ['CA']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['Sac State Union', 'LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSac State Union refers to LocationName = 'Sac State Union';\nHow many transactions were made at Sac State Union?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['Sac State American River Courtyard', 'LOST']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['MasterCard', 'Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard'; Master Card refers to CreditCardType = 'MasterCard';\nHow many purchases were made at Sac State American River Courtyard using Master Card?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.TransactionID) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State American River Courtyard' AND T1.CreditCardType = 'MasterCard'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(T1.TransactionID) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State American River Courtyard' AND T1.CreditCardType = 'MasterCard'",
"index": 2634,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['Sac State American River Courtyard', 'LOST']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['MasterCard', 'Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard'; Master Card refers to CreditCardType = 'MasterCard';\nHow many purchases were made at Sac State American River Courtyard using Master Card?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['TRUE', 'FALSE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['TRUE', 'FALSE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['TRUE', 'FALSE']\n ArtificialSweetener text, -- example: ['TRUE', 'FALSE']\n Caffeinated text, -- example: ['TRUE', 'FALSE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['TRUE', 'FALSE']\n AvailableInKegs text, -- example: ['TRUE', 'FALSE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbrand refers to BrandName; in 2012 refers to ReviewDate LIKE '2012%'; lowest star rating refers to MIN(StarRating); contains cane sugar as well as honey refers to CaneSugar = 'TRUE' AND Honey = 'TRUE';\nWhich brand in 2012 has the lowest star rating and contains cane sugar as well as honey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T1.CaneSugar = 'TRUE' AND T1.Honey = 'TRUE' AND T2.StarRating = 1 AND T2.ReviewDate LIKE '2012%'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT DISTINCT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T1.CaneSugar = 'TRUE' AND T1.Honey = 'TRUE' AND T2.StarRating = 1 AND T2.ReviewDate LIKE '2012%'",
"index": 2635,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['TRUE', 'FALSE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['TRUE', 'FALSE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['TRUE', 'FALSE']\n ArtificialSweetener text, -- example: ['TRUE', 'FALSE']\n Caffeinated text, -- example: ['TRUE', 'FALSE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['TRUE', 'FALSE']\n AvailableInKegs text, -- example: ['TRUE', 'FALSE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbrand refers to BrandName; in 2012 refers to ReviewDate LIKE '2012%'; lowest star rating refers to MIN(StarRating); contains cane sugar as well as honey refers to CaneSugar = 'TRUE' AND Honey = 'TRUE';\nWhich brand in 2012 has the lowest star rating and contains cane sugar as well as honey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nemail address refers to Email; transaction 100016 refers to TransactionID = 100016;\nWhat is the email address of the customer who made a purchase in transaction 100016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Email FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.TransactionID = '100016'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T1.Email FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.TransactionID = '100016'",
"index": 2636,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nemail address refers to Email; transaction 100016 refers to TransactionID = 100016;\nWhat is the email address of the customer who made a purchase in transaction 100016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocation refers to LocationName; bottle of beer refers to ContainerType = 'Bottle'; location that sold more bottles of beer refers to MAX(COUNT(LocationID WHERE ContainerType = 'Bottle'));\nWhich location sold more bottles of beer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.LocationName FROM rootbeer AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.ContainerType = 'Bottle' GROUP BY T2.LocationID ORDER BY COUNT(T1.LocationID) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T2.LocationName FROM rootbeer AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.ContainerType = 'Bottle' GROUP BY T2.LocationID ORDER BY COUNT(T1.LocationID) DESC LIMIT 1",
"index": 2637,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocation refers to LocationName; bottle of beer refers to ContainerType = 'Bottle'; location that sold more bottles of beer refers to MAX(COUNT(LocationID WHERE ContainerType = 'Bottle'));\nWhich location sold more bottles of beer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LocationID integer, -- example: [0, 1]\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nroot beer brands refers to BrandName; highest market evaluation and acceptance refers to MAX(COUNT(StarRating = 5));\nPlease name any three root beer brands that have the highest market evaluation and acceptance.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5 LIMIT 3",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT DISTINCT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5 LIMIT 3",
"index": 2638,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LocationID integer, -- example: [0, 1]\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nroot beer brands refers to BrandName; highest market evaluation and acceptance refers to MAX(COUNT(StarRating = 5));\nPlease name any three root beer brands that have the highest market evaluation and acceptance.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage quantity = AVG(Quantity); SalesID BETWEEN 20 AND 30;\nCalculate the average quantity per sales from sales id 20 to 30.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(Quantity) FROM Sales WHERE SalesID BETWEEN 20 AND 30",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT AVG(Quantity) FROM Sales WHERE SalesID BETWEEN 20 AND 30",
"index": 2639,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage quantity = AVG(Quantity); SalesID BETWEEN 20 AND 30;\nCalculate the average quantity per sales from sales id 20 to 30.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest quantity refers to MAX(Quantity);\nList down the product id for products with the highest quantity.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT ProductID FROM Sales WHERE Quantity = ( SELECT MAX(Quantity) FROM Sales )",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT DISTINCT ProductID FROM Sales WHERE Quantity = ( SELECT MAX(Quantity) FROM Sales )",
"index": 2640,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest quantity refers to MAX(Quantity);\nList down the product id for products with the highest quantity.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Min', 'Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest price refers to MIN(Price);\nHow many product ids have the lowest 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 COUNT(DISTINCT ProductID) FROM Products WHERE Price = ( SELECT MAX(Price) FROM Products )",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT ProductID) FROM Products WHERE Price = ( SELECT MAX(Price) FROM Products )",
"index": 2641,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Min', 'Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest price refers to MIN(Price);\nHow many product ids have the lowest 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 Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproducts from id 1 to 10 refers to ProductID BETWEEN 1 AND 10;\nList down the product name for products from id 1 to 10.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Name FROM Products WHERE ProductID BETWEEN 1 AND 10",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT Name FROM Products WHERE ProductID BETWEEN 1 AND 10",
"index": 2642,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproducts from id 1 to 10 refers to ProductID BETWEEN 1 AND 10;\nList down the product name for products from id 1 to 10.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abby', 'Aaron']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList down product ids that were purchased by customers called Abby.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.ProductID FROM Sales AS T1 INNER JOIN Customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.FirstName = 'Abby'",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT DISTINCT T1.ProductID FROM Sales AS T1 INNER JOIN Customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.FirstName = 'Abby'",
"index": 2643,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abby', 'Aaron']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList down product ids that were purchased by customers called Abby.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Meander', 'Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWrite down all of the product ids that were placed by Meander.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ProductID FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID WHERE T1.FirstName = 'Meander'",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT DISTINCT T2.ProductID FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID WHERE T1.FirstName = 'Meander'",
"index": 2644,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Meander', 'Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWrite down all of the product ids that were placed by Meander.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the last name of sales person for sales id 100?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.LastName FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID WHERE T2.SalesID = 100",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT T1.LastName FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID WHERE T2.SalesID = 100",
"index": 2645,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the last name of sales person for sales id 100?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abigail', 'Aaron', 'Abby']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n PRIMARY KEY (EmployeeID)\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 first name of employee who handled sales for customer called Abigail?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T3.FirstName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Employees AS T3 ON T2.SalesPersonID = T3.EmployeeID WHERE T1.FirstName = 'Abigail'",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT DISTINCT T3.FirstName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Employees AS T3 ON T2.SalesPersonID = T3.EmployeeID WHERE T1.FirstName = 'Abigail'",
"index": 2646,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abigail', 'Aaron', 'Abby']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n PRIMARY KEY (EmployeeID)\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 first name of employee who handled sales for customer called Abigail?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n MiddleInitial text, -- example: ['A', 'B']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n PRIMARY KEY (EmployeeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfree gifts refers to Price = 0;\nHow many free gifts have customer with id 11782 received?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.CustomerID = 11782 AND T1.Price = 0",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.CustomerID = 11782 AND T1.Price = 0",
"index": 2647,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n MiddleInitial text, -- example: ['A', 'B']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n PRIMARY KEY (EmployeeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfree gifts refers to Price = 0;\nHow many free gifts have customer with id 11782 received?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst name starting with alphabet \"s\" refers to FirstName LIKE 's%';\nList down all of the sales IDs for sales handled by sales people with first name starting with alphabet \"s\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.SalesID FROM Sales AS T1 INNER JOIN Employees AS T2 ON T1.SalesPersonID = T2.EmployeeID WHERE SUBSTR(T2.FirstName, 1, 1) = 's'",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT T1.SalesID FROM Sales AS T1 INNER JOIN Employees AS T2 ON T1.SalesPersonID = T2.EmployeeID WHERE SUBSTR(T2.FirstName, 1, 1) = 's'",
"index": 2648,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst name starting with alphabet \"s\" refers to FirstName LIKE 's%';\nList down all of the sales IDs for sales handled by sales people with first name starting with alphabet \"s\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Max', 'Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Price', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIDs from 1 to 100 refers to CustomerID BETWEEN 1 AND 100 ; highest price refers to MAX(Price);\nAmong customers with IDs from 1 to 100, what is the highest price of products they purchased?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Price FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.CustomerID BETWEEN 1 AND 100 ORDER BY T1.Price DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT T1.Price FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.CustomerID BETWEEN 1 AND 100 ORDER BY T1.Price DESC LIMIT 1",
"index": 2649,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Max', 'Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Price', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIDs from 1 to 100 refers to CustomerID BETWEEN 1 AND 100 ; highest price refers to MAX(Price);\nAmong customers with IDs from 1 to 100, what is the highest price of products they purchased?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Adam', 'Aaron', 'Abby']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal price = SUM(MULTIPLY(Price, Quantity));\nCalculate the total price of products purchased by Adam.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T3.Price * T2.quantity) FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T1.FirstName = 'Adam'",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT SUM(T3.Price * T2.quantity) FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T1.FirstName = 'Adam'",
"index": 2650,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Adam', 'Aaron', 'Abby']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal price = SUM(MULTIPLY(Price, Quantity));\nCalculate the total price of products purchased by Adam.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfreebies refers to Price = 0;\nAmong the products, how many of them are freebies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(ProductID) FROM Products WHERE Price = 0",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT COUNT(ProductID) FROM Products WHERE Price = 0",
"index": 2651,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfreebies refers to Price = 0;\nAmong the products, how many of them are freebies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nquantity is more than 950 refers to Quantity > 950;\nWrite down the name of products whose sale quantity is more than 950.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Name FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 950",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT DISTINCT T1.Name FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 950",
"index": 2652,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nquantity is more than 950 refers to Quantity > 950;\nWrite down the name of products whose sale quantity is more than 950.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst ten sales refers to SalesID BETWEEN 1 AND 10;\nTally the product name and quantity of the first ten sales.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Name, T2.Quantity FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T2.SalesID BETWEEN 1 AND 10",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT T3.Name, T2.Quantity FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T2.SalesID BETWEEN 1 AND 10",
"index": 2653,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst ten sales refers to SalesID BETWEEN 1 AND 10;\nTally the product name and quantity of the first ten sales.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Innes', 'Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['del Castillo', 'Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n MiddleInitial text, -- example: ['E', 'L', 'l', 'A', 'B']\n LastName text, -- example: ['Short', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Short-Sleeve Classic Jersey, L', 'Short-Sleeve Classic Jersey, M', 'Short-Sleeve Classic Jersey, S', 'Short-Sleeve Classic Jersey, XL', 'Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nShort-Sleeve Classic Jersey, L' is name of product;\nAmong all customers handled by Innes E. del Castillo, how many have purchased Short-Sleeve Classic Jersey, L?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CustomerID) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Employees AS T3 ON T2.SalesPersonID = T3.EmployeeID WHERE T3.FirstName = 'Innes' AND T3.LastName = 'del Castillo' AND T1.Name = 'Short-Sleeve Classic Jersey, L' AND T3.MiddleInitial = 'e'",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT COUNT(T2.CustomerID) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Employees AS T3 ON T2.SalesPersonID = T3.EmployeeID WHERE T3.FirstName = 'Innes' AND T3.LastName = 'del Castillo' AND T1.Name = 'Short-Sleeve Classic Jersey, L' AND T3.MiddleInitial = 'e'",
"index": 2654,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Innes', 'Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['del Castillo', 'Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n MiddleInitial text, -- example: ['E', 'L', 'l', 'A', 'B']\n LastName text, -- example: ['Short', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Short-Sleeve Classic Jersey, L', 'Short-Sleeve Classic Jersey, M', 'Short-Sleeve Classic Jersey, S', 'Short-Sleeve Classic Jersey, XL', 'Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nShort-Sleeve Classic Jersey, L' is name of product;\nAmong all customers handled by Innes E. del Castillo, how many have purchased Short-Sleeve Classic Jersey, L?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['White', 'Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Road-250 Black, 48', 'Road-250 Black, 44', 'Road-250 Black, 58', 'Road-250 Black, 52', 'Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Elizabeth', 'Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['White', 'Black', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the sales person = FirstName, MiddleInitial, LastName; 'Road-250 Black, 48' is name of product;\nName the sales person who helped Elizabeth A. White to purchase Road-250 Black, 48.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T3.FirstName, T3.MiddleInitial, T3.LastName FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Employees AS T3 ON T2.SalesPersonID = T3.EmployeeID INNER JOIN Customers AS T4 ON T2.CustomerID = T4.CustomerID WHERE T4.MiddleInitial = 'A' AND T4.LastName = 'White' AND T1.Name = 'Road-250 Black, 48' AND T4.FirstName = 'Elizabeth'",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT DISTINCT T3.FirstName, T3.MiddleInitial, T3.LastName FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Employees AS T3 ON T2.SalesPersonID = T3.EmployeeID INNER JOIN Customers AS T4 ON T2.CustomerID = T4.CustomerID WHERE T4.MiddleInitial = 'A' AND T4.LastName = 'White' AND T1.Name = 'Road-250 Black, 48' AND T4.FirstName = 'Elizabeth'",
"index": 2655,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['White', 'Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Road-250 Black, 48', 'Road-250 Black, 44', 'Road-250 Black, 58', 'Road-250 Black, 52', 'Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Elizabeth', 'Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['White', 'Black', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the sales person = FirstName, MiddleInitial, LastName; 'Road-250 Black, 48' is name of product;\nName the sales person who helped Elizabeth A. White to purchase Road-250 Black, 48.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Headlights - Weatherproof', 'Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n MiddleInitial text, -- example: ['A', 'B']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHeadlights - Weatherproof' is name of product\nHow many sales people managed to sell Headlights - Weatherproof?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.SalesPersonID) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Headlights - Weatherproof'",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT COUNT(T2.SalesPersonID) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Headlights - Weatherproof'",
"index": 2656,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Headlights - Weatherproof', 'Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n MiddleInitial text, -- example: ['A', 'B']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHeadlights - Weatherproof' is name of product\nHow many sales people managed to sell Headlights - Weatherproof?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Touring Rim', 'Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the customer = FirstName, MiddleInitial, LastName; 'Touring Rim' is name of product;\nName the customers who received 'Touring Rim' as a free gift.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.FirstName, T1.MiddleInitial, T1.LastName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T3.Name = 'Touring Rim' AND T3.Price = 0",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT DISTINCT T1.FirstName, T1.MiddleInitial, T1.LastName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T3.Name = 'Touring Rim' AND T3.Price = 0",
"index": 2657,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Touring Rim', 'Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the customer = FirstName, MiddleInitial, LastName; 'Touring Rim' is name of product;\nName the customers who received 'Touring Rim' as a free gift.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Min', 'Max', 'Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost expensive product refers to MAX(Price); least expensive product refers to MIN(Price); excluding free gifts refers to not including Price = 0;\nName the most expensive and the least expensive products available, excluding free gifts.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Name FROM Products WHERE Price IN (( SELECT MAX(Price) FROM Products ), ( SELECT MIN(Price) FROM Products ))",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT Name FROM Products WHERE Price IN (( SELECT MAX(Price) FROM Products ), ( SELECT MIN(Price) FROM Products ))",
"index": 2658,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Min', 'Max', 'Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost expensive product refers to MAX(Price); least expensive product refers to MIN(Price); excluding free gifts refers to not including Price = 0;\nName the most expensive and the least expensive products available, excluding free gifts.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost sold refers to MAX(Quantity);\nWhat is the name of the product that is most sold by sale person id 20?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Name FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.SalesPersonID = 20 ORDER BY T2.Quantity DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT T1.Name FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.SalesPersonID = 20 ORDER BY T2.Quantity DESC LIMIT 1",
"index": 2659,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost sold refers to MAX(Quantity);\nWhat is the name of the product that is most sold by sale person id 20?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n LastName text, -- example: ['Price', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npriced from 1000 to 2000 refers to Price BETWEEN 1000 AND 2000;\nIdentify customer IDs who bought products priced from 1000 to 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 DISTINCT T2.CustomerID FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Price BETWEEN 1000 AND 2000",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT DISTINCT T2.CustomerID FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Price BETWEEN 1000 AND 2000",
"index": 2660,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n LastName text, -- example: ['Price', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npriced from 1000 to 2000 refers to Price BETWEEN 1000 AND 2000;\nIdentify customer IDs who bought products priced from 1000 to 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 Products (\n ProductID integer, -- example: [1, 2]\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal quantity = SUM(Quantity); gifts refers to Price = 0;\nCalculate the total quantity of products that are gifts.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Quantity) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Price = 0",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT SUM(T2.Quantity) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Price = 0",
"index": 2661,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal quantity = SUM(Quantity); gifts refers to Price = 0;\nCalculate the total quantity of products that are gifts.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Ringer', 'Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\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 of the employees have the last name \"Ringer\" ?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(LastName) FROM Employees WHERE LastName = 'Ringer'",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT COUNT(LastName) FROM Employees WHERE LastName = 'Ringer'",
"index": 2662,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Ringer', 'Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\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 of the employees have the last name \"Ringer\" ?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Alexander', 'Aaron', 'Abby']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGive the product's name brought by Aaron Alexander.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Name FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Customers AS T3 ON T2.CustomerID = T3.CustomerID WHERE T3.FirstName = 'Aaron' AND T3.LastName = 'Alexander'",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT DISTINCT T1.Name FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Customers AS T3 ON T2.CustomerID = T3.CustomerID WHERE T3.FirstName = 'Aaron' AND T3.LastName = 'Alexander'",
"index": 2663,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Alexander', 'Aaron', 'Abby']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGive the product's name brought by Aaron Alexander.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Max', 'Aaron', 'Abby']\n LastName text, -- example: ['Price', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest prices refers to MAX(Price); quantity ranges from 400 to 500 refers to Quantity BETWEEN 400 AND 500;\nGive the product ID and name of the product with the highest prices among the quantity ranges from 400 to 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 T1.ProductID, T1.Name FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.quantity BETWEEN 400 AND 500 ORDER BY T1.Price DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT T1.ProductID, T1.Name FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.quantity BETWEEN 400 AND 500 ORDER BY T1.Price DESC LIMIT 1",
"index": 2664,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Max', 'Aaron', 'Abby']\n LastName text, -- example: ['Price', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest prices refers to MAX(Price); quantity ranges from 400 to 500 refers to Quantity BETWEEN 400 AND 500;\nGive the product ID and name of the product with the highest prices among the quantity ranges from 400 to 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 Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Kate', 'Max', 'Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest quantity refers to MAX(Quantity);\nAmong customers named Kate, who has the highest quantity?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.FirstName, T2.LastName FROM Sales AS T1 INNER JOIN Customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.FirstName = 'Kate' ORDER BY T1.Quantity DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT T2.FirstName, T2.LastName FROM Sales AS T1 INNER JOIN Customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.FirstName = 'Kate' ORDER BY T1.Quantity DESC LIMIT 1",
"index": 2665,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Kate', 'Max', 'Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest quantity refers to MAX(Quantity);\nAmong customers named Kate, who has the highest quantity?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n MiddleInitial text, -- example: ['e', 'l']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn sales with a quantity of 60, how many of them have a price not greater than 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.ProductID) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.quantity = 60 AND T1.Price <= 500",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.quantity = 60 AND T1.Price <= 500",
"index": 2666,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n MiddleInitial text, -- example: ['e', 'l']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn sales with a quantity of 60, how many of them have a price not greater than 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 Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Seat Tube', 'Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the price and quantity of the product named Seat Tube?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Price, T1.Quantity FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Seat Tube'",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT DISTINCT T2.Price, T1.Quantity FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Seat Tube'",
"index": 2667,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Seat Tube', 'Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the price and quantity of the product named Seat Tube?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwho refers to FirstName, LastName;\nIn sales ID between 30 and 40, who is the customer that bought a total quantity of 403?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Sales AS T1 INNER JOIN Customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Quantity = 403 AND T1.SalesID BETWEEN 30 AND 40",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT T2.FirstName, T2.LastName FROM Sales AS T1 INNER JOIN Customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Quantity = 403 AND T1.SalesID BETWEEN 30 AND 40",
"index": 2668,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwho refers to FirstName, LastName;\nIn sales ID between 30 and 40, who is the customer that bought a total quantity of 403?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n LastName text, -- example: ['Price', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsales ID ranges from 1 to 200 refers to SalesID between 1 and 200; percentage = MULTIPLY(DIVIDE(SUM(Price between 200 and 300), COUNT(Price)), 1.0);\nAmong the sales ID ranges from 1 to 200, what is the percentage of the products with a price ranging from 200 to 300?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(IIF(T2.Price BETWEEN 200 AND 300, 1, 0)) AS REAL) * 100 / COUNT(T2.Price) FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID WHERE T1.SalesID BETWEEN 1 AND 200",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT CAST(SUM(IIF(T2.Price BETWEEN 200 AND 300, 1, 0)) AS REAL) * 100 / COUNT(T2.Price) FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID WHERE T1.SalesID BETWEEN 1 AND 200",
"index": 2669,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n LastName text, -- example: ['Price', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsales ID ranges from 1 to 200 refers to SalesID between 1 and 200; percentage = MULTIPLY(DIVIDE(SUM(Price between 200 and 300), COUNT(Price)), 1.0);\nAmong the sales ID ranges from 1 to 200, what is the percentage of the products with a price ranging from 200 to 300?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Madison', 'Aaron', 'Abby']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n PRIMARY KEY (EmployeeID)\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 customers are named Madison?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(CustomerID) FROM Customers WHERE FirstName = 'Madison'",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT COUNT(CustomerID) FROM Customers WHERE FirstName = 'Madison'",
"index": 2670,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Madison', 'Aaron', 'Abby']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n PRIMARY KEY (EmployeeID)\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 customers are named Madison?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Black', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMountain-500 Black 42' is name of product; sold in total = SUM(Quantity);\nHow many \"Mountain-500 Black 42\" were sold in total?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T2.Quantity) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Mountain-500 Black, 42'",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT SUM(T2.Quantity) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Mountain-500 Black, 42'",
"index": 2671,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Black', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMountain-500 Black 42' is name of product; sold in total = SUM(Quantity);\nHow many \"Mountain-500 Black 42\" were sold in total?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Heather', 'Abraham', 'Reginald']\n LastName text, -- example: ['McBadden', 'Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Heather', 'Aaron', 'Abby']\n LastName text, -- example: ['Price', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal amount of sales = SUM(MULTIPLY(Quantity, Price));\nHow much is the total amount of sales handled by Heather McBadden?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Quantity * T3.Price) FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T1.FirstName = 'Heather' AND T1.LastName = 'McBadden'",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT SUM(T2.Quantity * T3.Price) FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T1.FirstName = 'Heather' AND T1.LastName = 'McBadden'",
"index": 2672,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Heather', 'Abraham', 'Reginald']\n LastName text, -- example: ['McBadden', 'Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Heather', 'Aaron', 'Abby']\n LastName text, -- example: ['Price', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal amount of sales = SUM(MULTIPLY(Quantity, Price));\nHow much is the total amount of sales handled by Heather McBadden?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Chainring Bolts', 'Chainring', 'Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChainring Bolts' is name of product;\nHow many chainring bolts were sold under sales ID 551971?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Quantity FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Chainring Bolts' AND T1.SalesID = 551971",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT T1.Quantity FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Chainring Bolts' AND T1.SalesID = 551971",
"index": 2673,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Chainring Bolts', 'Chainring', 'Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChainring Bolts' is name of product;\nHow many chainring bolts were sold under sales ID 551971?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Touring-2000 Blue, 50', 'Touring-2000 Blue, 54', 'Touring-2000 Blue, 46', 'Touring-2000 Blue, 60', 'Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nover 20,000 quantities refers to Quantity > 20000; 'Touring-2000 Blue, 50' is name of product;\nHow many employees sold over 20,000 quantities of \"Touring-2000 Blue, 50\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM ( SELECT SUM(Quantity) FROM Sales WHERE ProductID IN ( SELECT ProductID FROM Products WHERE Name = 'Touring-2000 Blue, 50' ) GROUP BY Quantity, SalesPersonID HAVING SUM(Quantity) > 20000 )",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT COUNT(*) FROM ( SELECT SUM(Quantity) FROM Sales WHERE ProductID IN ( SELECT ProductID FROM Products WHERE Name = 'Touring-2000 Blue, 50' ) GROUP BY Quantity, SalesPersonID HAVING SUM(Quantity) > 20000 )",
"index": 2674,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Touring-2000 Blue, 50', 'Touring-2000 Blue, 54', 'Touring-2000 Blue, 46', 'Touring-2000 Blue, 60', 'Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Aaron', 'Abby']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nover 20,000 quantities refers to Quantity > 20000; 'Touring-2000 Blue, 50' is name of product;\nHow many employees sold over 20,000 quantities of \"Touring-2000 Blue, 50\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Max', 'Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Price', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name of the customer = FirstName, MiddleInitial, LastName; most amount of products refers to MAX(MULTIPLY(Quantity, Price));\nGive the full name of the customer who bought the most amount of products.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.MiddleInitial, T3.LastName FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Customers AS T3 ON T2.CustomerID = T3.CustomerID ORDER BY T2.Quantity * T1.Price DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "sales.sqlite",
"gt_sql": "SELECT T3.FirstName, T3.MiddleInitial, T3.LastName FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Customers AS T3 ON T2.CustomerID = T3.CustomerID ORDER BY T2.Quantity * T1.Price DESC LIMIT 1",
"index": 2675,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n SalesID integer, -- example: [1, 2]\n SalesPersonID integer, -- example: [17, 5]\n CustomerID integer, -- example: [10482, 1964]\n ProductID integer, -- example: [500, 306]\n Quantity integer, -- example: [500, 810]\n PRIMARY KEY (SalesID),\n CONSTRAINT fk_sales_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_sales_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_sales_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n Name text, -- example: ['Adjustable Race', 'Bearing Ball']\n Price real, -- example: [1.6, 0.8]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Abraham', 'Reginald']\n MiddleInitial text, -- example: ['e', 'l']\n LastName text, -- example: ['Bennet', 'Blotchet-Halls']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n FirstName text, -- example: ['Max', 'Aaron', 'Abby']\n MiddleInitial text, -- example: ['A', 'B']\n LastName text, -- example: ['Price', 'Alexander', 'Bryant']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name of the customer = FirstName, MiddleInitial, LastName; most amount of products refers to MAX(MULTIPLY(Quantity, Price));\nGive the full name of the customer who bought the most amount of products.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n menus_appeared integer, -- example: [8, 111]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndo not have correct data refers to first_appeared < 1851 or first_appeared > 2012;\nHow many dishes do not have correct data for the year in which it appeared first?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM Dish WHERE first_appeared < 1851 OR first_appeared > 2012",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Dish WHERE first_appeared < 1851 OR first_appeared > 2012",
"index": 2676,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n menus_appeared integer, -- example: [8, 111]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndo not have correct data refers to first_appeared < 1851 or first_appeared > 2012;\nHow many dishes do not have correct data for the year in which it appeared first?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Clear green turtle ', 'Clear Green Turtle ', 'Clear Green Turtle', 'Green Turtle ', 'Green Turtle', 'Green turtle']\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `language` text,\n location text, -- example: ['Hotel Eastman', 'Republican House']\n currency text, -- example: ['Dollars', 'Cents']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest price refers to MAX(Price); Clear green turtle is a name of dish;\nWhat is the highest price of the dish \"Clear green turtle\" on a menu page?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.price FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.name = 'Clear green turtle' ORDER BY T2.price DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T2.price FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.name = 'Clear green turtle' ORDER BY T2.price DESC LIMIT 1",
"index": 2677,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Clear green turtle ', 'Clear Green Turtle ', 'Clear Green Turtle', 'Green Turtle ', 'Green Turtle', 'Green turtle']\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `language` text,\n location text, -- example: ['Hotel Eastman', 'Republican House']\n currency text, -- example: ['Dollars', 'Cents']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest price refers to MAX(Price); Clear green turtle is a name of dish;\nWhat is the highest price of the dish \"Clear green turtle\" on a menu page?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Clear green turtle ', 'Clear Green Turtle ', 'Clear Green Turtle', 'Green Turtle ', 'Green Turtle', 'Green turtle']\n description text,\n menus_appeared integer, -- example: [8, 111]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['NULL', 'COMMERCIAL', 'SOC;']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['NULL', 'EASTER;', 'ANNIVERSARY;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n full_height integer, -- example: [7230, 5428]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nClear green turtle is a name of dish; not support taking out or booking in advance refers to call_number is null;\nAmong the menus in which the dish \"Clear green turtle\" had appeared, how many of them did not support taking out or booking in advance?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN T4.name = 'Clear green turtle' THEN 1 ELSE 0 END) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T3.call_number IS NULL",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T4.name = 'Clear green turtle' THEN 1 ELSE 0 END) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T3.call_number IS NULL",
"index": 2678,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Clear green turtle ', 'Clear Green Turtle ', 'Clear Green Turtle', 'Green Turtle ', 'Green Turtle', 'Green turtle']\n description text,\n menus_appeared integer, -- example: [8, 111]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['NULL', 'COMMERCIAL', 'SOC;']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['NULL', 'EASTER;', 'ANNIVERSARY;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n full_height integer, -- example: [7230, 5428]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nClear green turtle is a name of dish; not support taking out or booking in advance refers to call_number is null;\nAmong the menus in which the dish \"Clear green turtle\" had appeared, how many of them did not support taking out or booking in advance?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n times_appeared integer, -- example: [8, 117]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Zentral Theater Terrace', 'The Modern', 'Restaurant']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `language` text,\n location text, -- example: ['Zentral Theater Terrace', 'Hotel Eastman', 'Republican House']\n location_type text,\n status text, -- example: ['complete']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nZentral Theater Terrace is a name of menu;\nHow many dishes are there on the menu \"Zentral Theater Terrace\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN T3.name = 'Zentral Theater Terrace' THEN 1 ELSE 0 END) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T3.name = 'Zentral Theater Terrace' THEN 1 ELSE 0 END) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id",
"index": 2679,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n times_appeared integer, -- example: [8, 117]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Zentral Theater Terrace', 'The Modern', 'Restaurant']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `language` text,\n location text, -- example: ['Zentral Theater Terrace', 'Hotel Eastman', 'Republican House']\n location_type text,\n status text, -- example: ['complete']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nZentral Theater Terrace is a name of menu;\nHow many dishes are there on the menu \"Zentral Theater Terrace\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Clear green turtle ', 'Clear Green Turtle ', 'Clear Green Turtle', 'Green Turtle ', 'Green Turtle', 'Green turtle']\n description text,\n menus_appeared integer, -- example: [8, 111]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Restaurant', 'The Modern']\n sponsor text, -- example: ['The Restaurant', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n venue text, -- example: ['RESTAURANT', 'NULL', 'COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['NULL', 'EASTER;', 'ANNIVERSARY;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n status text, -- example: ['complete']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIDs of the menus refers to menu_id; menus that are DIYs of the restaurant refers to sponsor is null; Clear green turtle is a name of dish;\nPlease list the IDs of the menus that are DIYs of the restaurant and have the dish \"Clear green turtle\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.menu_id FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T4.name = 'Clear green turtle' AND T3.sponsor IS NULL",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T2.menu_id FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T4.name = 'Clear green turtle' AND T3.sponsor IS NULL",
"index": 2680,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Clear green turtle ', 'Clear Green Turtle ', 'Clear Green Turtle', 'Green Turtle ', 'Green Turtle', 'Green turtle']\n description text,\n menus_appeared integer, -- example: [8, 111]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Restaurant', 'The Modern']\n sponsor text, -- example: ['The Restaurant', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n venue text, -- example: ['RESTAURANT', 'NULL', 'COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['NULL', 'EASTER;', 'ANNIVERSARY;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n status text, -- example: ['complete']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIDs of the menus refers to menu_id; menus that are DIYs of the restaurant refers to sponsor is null; Clear green turtle is a name of dish;\nPlease list the IDs of the menus that are DIYs of the restaurant and have the dish \"Clear green turtle\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Clear green turtle ', 'Clear Green Turtle ', 'Clear Green Turtle', 'Green Turtle ', 'Green Turtle', 'Green turtle']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage page number = AVG(page_number); Clear green turtle is a name of dish;\nWhat is the average page number of the menus that have the dish \"Clear green turtle\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.page_number) FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T3.name = 'Clear green turtle'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT AVG(T1.page_number) FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T3.name = 'Clear green turtle'",
"index": 2681,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Clear green turtle ', 'Clear Green Turtle ', 'Clear Green Turtle', 'Green Turtle ', 'Green Turtle', 'Green turtle']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage page number = AVG(page_number); Clear green turtle is a name of dish;\nWhat is the average page number of the menus that have the dish \"Clear green turtle\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Zentral Theater Terrace', 'The Modern', 'Restaurant']\n sponsor text, -- example: ['Zentral Theater Terrace', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Zentral Theater Terrace', 'Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage price = AVG(price); Zentral Theater Terrace refers to menu;\nWhat is the average price of the dishes on the menu \"Zentral Theater Terrace\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T1.price) / COUNT(T1.price) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id WHERE T3.name = 'Zentral Theater Terrace'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT SUM(T1.price) / COUNT(T1.price) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id WHERE T3.name = 'Zentral Theater Terrace'",
"index": 2682,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Zentral Theater Terrace', 'The Modern', 'Restaurant']\n sponsor text, -- example: ['Zentral Theater Terrace', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Zentral Theater Terrace', 'Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage price = AVG(price); Zentral Theater Terrace refers to menu;\nWhat is the average price of the dishes on the menu \"Zentral Theater Terrace\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_height integer, -- example: [7230, 5428]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n currency text, -- example: ['Dollars', 'Cents']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n description text,\n times_appeared integer, -- example: [8, 117]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncreated on 28th March 2011 refers to created_at like '2011-03-28%';\nHow many menu items were created on 28th March 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM MenuItem WHERE created_at LIKE '2011-03-28%'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT COUNT(*) FROM MenuItem WHERE created_at LIKE '2011-03-28%'",
"index": 2683,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_height integer, -- example: [7230, 5428]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n currency text, -- example: ['Dollars', 'Cents']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n description text,\n times_appeared integer, -- example: [8, 117]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncreated on 28th March 2011 refers to created_at like '2011-03-28%';\nHow many menu items were created on 28th March 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n venue text, -- example: ['STEAMSHIP', 'COMMERCIAL', 'SOC;']\n place text, -- example: ['STEAMSHIP', 'HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n currency text, -- example: ['Dollars', 'Cents']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n first_appeared integer, -- example: [1897, 1895]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsteamship refers to venue = 'STEAMSHIP';\nHow many menus were created for steamship?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM Menu WHERE venue = 'STEAMSHIP'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Menu WHERE venue = 'STEAMSHIP'",
"index": 2684,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n venue text, -- example: ['STEAMSHIP', 'COMMERCIAL', 'SOC;']\n place text, -- example: ['STEAMSHIP', 'HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n currency text, -- example: ['Dollars', 'Cents']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n first_appeared integer, -- example: [1897, 1895]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsteamship refers to venue = 'STEAMSHIP';\nHow many menus were created for steamship?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'menu', 'MENU', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n last_appeared integer, -- example: [1927, 1960]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nName the dishes that were on the menu page ID 174.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.name FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T2.id = T1.dish_id WHERE T1.menu_page_id = 174",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T2.name FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T2.id = T1.dish_id WHERE T1.menu_page_id = 174",
"index": 2685,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'menu', 'MENU', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n last_appeared integer, -- example: [1927, 1960]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nName the dishes that were on the menu page ID 174.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'menu', 'MENU', 'list', 'Consomme printaniere royal']\n description text,\n menus_appeared integer, -- example: [8, 111]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst appeared in 1861 refers to first_appeared = 1861;\nList the names and menu page IDs of the dishes that first appeared in 1861.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.name, T1.dish_id FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T2.id = T1.dish_id WHERE T2.first_appeared = 1861",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T2.name, T1.dish_id FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T2.id = T1.dish_id WHERE T2.first_appeared = 1861",
"index": 2686,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'menu', 'MENU', 'list', 'Consomme printaniere royal']\n description text,\n menus_appeared integer, -- example: [8, 111]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst appeared in 1861 refers to first_appeared = 1861;\nList the names and menu page IDs of the dishes that first appeared in 1861.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location_type text,\n status text, -- example: ['complete']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'list', 'menu', 'MENU', 'dish', 'Consomme printaniere royal']\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest prices of the dishes refers to MAX(price); created on 23rd May 2011 refers to created_at like '2011-05-23%';\nAmong the dishes on menu page ID 7610, list the names and highest prices of the dishes in menu items that were created on 23rd May 2011.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name, T2.price FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T2.created_at LIKE '2011-05-23%' ORDER BY T2.price DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T1.name, T2.price FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T2.created_at LIKE '2011-05-23%' ORDER BY T2.price DESC LIMIT 1",
"index": 2687,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location_type text,\n status text, -- example: ['complete']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'list', 'menu', 'MENU', 'dish', 'Consomme printaniere royal']\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest prices of the dishes refers to MAX(price); created on 23rd May 2011 refers to created_at like '2011-05-23%';\nAmong the dishes on menu page ID 7610, list the names and highest prices of the dishes in menu items that were created on 23rd May 2011.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'list', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n first_appeared integer, -- example: [1897, 1895]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n location text, -- example: ['Hotel Eastman', 'Republican House']\n currency text, -- example: ['Dollars', 'Cents']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleast in full height refers to MIN(full_height);\nList the dishes included on page number 30 with the least in full height.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.name FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T1.page_number = 30 ORDER BY T1.full_height DESC, T1.full_height ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T3.name FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T1.page_number = 30 ORDER BY T1.full_height DESC, T1.full_height ASC LIMIT 1",
"index": 2688,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'list', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n first_appeared integer, -- example: [1897, 1895]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n location text, -- example: ['Hotel Eastman', 'Republican House']\n currency text, -- example: ['Dollars', 'Cents']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleast in full height refers to MIN(full_height);\nList the dishes included on page number 30 with the least in full height.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n menus_appeared integer, -- example: [8, 111]\n last_appeared integer, -- example: [1927, 1960]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n event text, -- example: ['BREAKFAST', '[DINNER]']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n keywords text,\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmenu with the most dishes refers to menu.id with MAX(dish_count); second page refers to page_number = 2;\nOn the menu with the most dishes, how many dishes were there on its second page?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.dish_id) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id WHERE T2.page_number = 2 GROUP BY T3.name ORDER BY T3.dish_count DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT COUNT(T1.dish_id) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id WHERE T2.page_number = 2 GROUP BY T3.name ORDER BY T3.dish_count DESC LIMIT 1",
"index": 2689,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n menus_appeared integer, -- example: [8, 111]\n last_appeared integer, -- example: [1927, 1960]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n event text, -- example: ['BREAKFAST', '[DINNER]']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n keywords text,\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmenu with the most dishes refers to menu.id with MAX(dish_count); second page refers to page_number = 2;\nOn the menu with the most dishes, how many dishes were there on its second page?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: [\"CHAS.BRADLEY'S OYSTER & DINING ROOM\", 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: [\"Chas.Bradley's Oyster & Dining Room\", 'Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'Menu.', 'menu', 'MENU', 'dish', 'list']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nappeared at the left upper corner refers to xpos < 0.25 and ypos < 0.25; CHAS.BRADLEY'S OYSTER & DINING ROOM refers to sponsor = 'CHAS.BRADLEY''S OYSTER & DINING ROOM';\nList the dishes that appeared at the left upper corner of the CHAS.BRADLEY'S OYSTER & DINING ROOM\"s sponsored menu.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T3.sponsor = 'CHAS.BRADLEY''S OYSTER & DINING ROOM' AND T1.xpos < 0.25 AND T1.ypos < 0.25",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T4.name FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T3.sponsor = 'CHAS.BRADLEY''S OYSTER & DINING ROOM' AND T1.xpos < 0.25 AND T1.ypos < 0.25",
"index": 2690,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: [\"CHAS.BRADLEY'S OYSTER & DINING ROOM\", 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: [\"Chas.Bradley's Oyster & Dining Room\", 'Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'Menu.', 'menu', 'MENU', 'dish', 'list']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nappeared at the left upper corner refers to xpos < 0.25 and ypos < 0.25; CHAS.BRADLEY'S OYSTER & DINING ROOM refers to sponsor = 'CHAS.BRADLEY''S OYSTER & DINING ROOM';\nList the dishes that appeared at the left upper corner of the CHAS.BRADLEY'S OYSTER & DINING ROOM\"s sponsored menu.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['bluefish ', 'Bluefish ', 'bluefish', 'Bluefish', 'DISHES', 'menu']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercent = MULTIPLY(DIVIDE(SUM(xpos BETWEEN 0.25 AND 0.75 and ypos BETWEEN 0.25 AND 0.75), COUNT(id)), 1.0); Bluefish is a sub name of dish; located at the center of the menu page refers to xpos BETWEEN 0.25 AND 0.75 and ypos BETWEEN 0.25 AND 0.75;\nHow many percent of Bluefish dishes are located at the center of the menu page?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T2.xpos BETWEEN 0.25 AND 0.75 AND T2.ypos BETWEEN 0.25 AND 0.75 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.id) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.name LIKE '%BLuefish%'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.xpos BETWEEN 0.25 AND 0.75 AND T2.ypos BETWEEN 0.25 AND 0.75 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.id) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.name LIKE '%BLuefish%'",
"index": 2691,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['bluefish ', 'Bluefish ', 'bluefish', 'Bluefish', 'DISHES', 'menu']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercent = MULTIPLY(DIVIDE(SUM(xpos BETWEEN 0.25 AND 0.75 and ypos BETWEEN 0.25 AND 0.75), COUNT(id)), 1.0); Bluefish is a sub name of dish; located at the center of the menu page refers to xpos BETWEEN 0.25 AND 0.75 and ypos BETWEEN 0.25 AND 0.75;\nHow many percent of Bluefish dishes are located at the center of the menu page?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n lowest_price real, -- example: [0.2, 0.1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n sponsor text, -- example: ['THE PLACE', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `language` text,\n location text, -- example: ['The Place', 'Hotel Eastman', 'Republican House']\n location_type text,\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplace refers to location;\nWhere is the place that menu with ID 12472 was created for?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT location FROM Menu WHERE id = 12472",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT location FROM Menu WHERE id = 12472",
"index": 2692,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n lowest_price real, -- example: [0.2, 0.1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n sponsor text, -- example: ['THE PLACE', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `language` text,\n location text, -- example: ['The Place', 'Hotel Eastman', 'Republican House']\n location_type text,\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplace refers to location;\nWhere is the place that menu with ID 12472 was created for?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_height integer, -- example: [7230, 5428]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n lowest_price real, -- example: [0.2, 0.1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n sponsor text, -- example: ['NOVIOMAGUS', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Noviomagus', 'Hotel Eastman', 'Republican House']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndescribe the menu physically refers to physical_description; sponsored by Noviomagus refers to sponsor = 'Noviomagus';\nPlease describe the menu sponsored by Noviomagus physically.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT physical_description FROM Menu WHERE sponsor = 'Noviomagus'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT physical_description FROM Menu WHERE sponsor = 'Noviomagus'",
"index": 2693,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_height integer, -- example: [7230, 5428]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n lowest_price real, -- example: [0.2, 0.1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n sponsor text, -- example: ['NOVIOMAGUS', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Noviomagus', 'Hotel Eastman', 'Republican House']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndescribe the menu physically refers to physical_description; sponsored by Noviomagus refers to sponsor = 'Noviomagus';\nPlease describe the menu sponsored by Noviomagus physically.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['NORDDEUTSCHER LLOYD', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n `language` text,\n location text, -- example: ['Norddeutscher Lloyd Bremen', 'Norddeutscher Lloyd', 'Norddeutscher Lloyd Bremen;', 'Hotel Eastman', 'Republican House']\n location_type text,\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsponsored by Norddeutscher Lloyd Bremen refers to sponsor = 'Norddeutscher Lloyd Bremen';\nList down the locations of menu sponsored by Norddeutscher Lloyd Bremen.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT location FROM Menu WHERE sponsor = 'Norddeutscher Lloyd Bremen'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT location FROM Menu WHERE sponsor = 'Norddeutscher Lloyd Bremen'",
"index": 2694,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['NORDDEUTSCHER LLOYD', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n `language` text,\n location text, -- example: ['Norddeutscher Lloyd Bremen', 'Norddeutscher Lloyd', 'Norddeutscher Lloyd Bremen;', 'Hotel Eastman', 'Republican House']\n location_type text,\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsponsored by Norddeutscher Lloyd Bremen refers to sponsor = 'Norddeutscher Lloyd Bremen';\nList down the locations of menu sponsored by Norddeutscher Lloyd Bremen.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Manhattan ', 'MANHATTAN', 'Manhattan', 'menu', 'MENU', 'list']\n description text,\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n `language` text,\n location text, -- example: ['Manhattan Hotel', 'Hotel Eastman', 'Republican House']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocated at Manhattan Hotel refers to location = 'Manhattan Hotel';\nList down the image IDs for menu located at Manhattan Hotel.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.image_id FROM MenuPage AS T1 INNER JOIN Menu AS T2 ON T2.id = T1.menu_id WHERE T2.location = 'Manhattan Hotel'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T1.image_id FROM MenuPage AS T1 INNER JOIN Menu AS T2 ON T2.id = T1.menu_id WHERE T2.location = 'Manhattan Hotel'",
"index": 2695,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Manhattan ', 'MANHATTAN', 'Manhattan', 'menu', 'MENU', 'list']\n description text,\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n `language` text,\n location text, -- example: ['Manhattan Hotel', 'Hotel Eastman', 'Republican House']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocated at Manhattan Hotel refers to location = 'Manhattan Hotel';\nList down the image IDs for menu located at Manhattan Hotel.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'del', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n times_appeared integer, -- example: [8, 117]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['El Fuerte Del Palmar', 'The Modern', 'Restaurant']\n sponsor text, -- example: ['El Fuerte Del Palmar', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['El Fuerte Del Palmar', 'Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwidth refers to full_width; El Fuerte Del Palmar is a name of menu;\nState the full height and width for menu called \"El Fuerte Del Palmar\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.full_height, T1.full_width FROM MenuPage AS T1 INNER JOIN Menu AS T2 ON T2.id = T1.menu_id WHERE T2.name = 'El Fuerte Del Palmar'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T1.full_height, T1.full_width FROM MenuPage AS T1 INNER JOIN Menu AS T2 ON T2.id = T1.menu_id WHERE T2.name = 'El Fuerte Del Palmar'",
"index": 2696,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'del', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n times_appeared integer, -- example: [8, 117]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['El Fuerte Del Palmar', 'The Modern', 'Restaurant']\n sponsor text, -- example: ['El Fuerte Del Palmar', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['El Fuerte Del Palmar', 'Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwidth refers to full_width; El Fuerte Del Palmar is a name of menu;\nState the full height and width for menu called \"El Fuerte Del Palmar\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlongest full height refers to MAX(full_height);\nState the name of menu with the longest full height.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.name FROM MenuPage AS T1 INNER JOIN Menu AS T2 ON T2.id = T1.menu_id ORDER BY T1.full_height DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T2.name FROM MenuPage AS T1 INNER JOIN Menu AS T2 ON T2.id = T1.menu_id ORDER BY T1.full_height DESC LIMIT 1",
"index": 2697,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlongest full height refers to MAX(full_height);\nState the name of menu with the longest full height.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nHow much is the price of menu with image ID 4000009194?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.price FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id INNER JOIN MenuItem AS T3 ON T2.id = T3.menu_page_id WHERE T2.image_id = 4000009194",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T3.price FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id INNER JOIN MenuItem AS T3 ON T2.id = T3.menu_page_id WHERE T2.image_id = 4000009194",
"index": 2698,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nHow much is the price of menu with image ID 4000009194?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'menu', 'MENU', 'from', 'dish', 'list']\n description text,\n menus_appeared integer, -- example: [8, 111]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nList down name of dishes from menu with menu page ID 1389.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.name FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T2.id = T1.dish_id WHERE T1.menu_page_id = 1389",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T2.name FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T2.id = T1.dish_id WHERE T1.menu_page_id = 1389",
"index": 2699,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'menu', 'MENU', 'from', 'dish', 'list']\n description text,\n menus_appeared integer, -- example: [8, 111]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nList down name of dishes from menu with menu page ID 1389.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\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.