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 coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['COIN', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['coin', 'bitcoin', 'litecoin']\n symbol text, -- example: ['NAME', 'COIN', 'MAY', 'S', 'BTC', 'LTC']\n status text, -- example: ['active', 'untracked']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-05-29', '2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage that is higher than the price 1 hour ago refers to percent_change_1h>0; in May 29,2013 refers to date = '2013-05-29'\nWhat's the percentage of coins that is higher than the price 1 hour ago in May 29,2013? List the names of these coins.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 coins AS T1 INNER JOIN historical AS T2 ON T1.ID = T2.coin_id WHERE T2.DATE = '2013-05-29' AND T2.percent_change_1h > 0", "style": "rule" }
{ "db_id": "coinmarketcap.sqlite", "gt_sql": "SELECT T1.NAME FROM coins AS T1 INNER JOIN historical AS T2 ON T1.ID = T2.coin_id WHERE T2.DATE = '2013-05-29' AND T2.percent_change_1h > 0", "index": 3100, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['COIN', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['coin', 'bitcoin', 'litecoin']\n symbol text, -- example: ['NAME', 'COIN', 'MAY', 'S', 'BTC', 'LTC']\n status text, -- example: ['active', 'untracked']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-05-29', '2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage that is higher than the price 1 hour ago refers to percent_change_1h>0; in May 29,2013 refers to date = '2013-05-29'\nWhat's the percentage of coins that is higher than the price 1 hour ago in May 29,2013? List the names of these coins.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n City text, -- example: ['Berlin', 'México D.F.']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_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:\nto whom refers to ReportsTo; full name = FirstName, LastName;\nTo whom does Nancy Davolio report? Please give that employee's full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT FirstName, LastName FROM Employees WHERE EmployeeID = ( SELECT ReportsTo FROM Employees WHERE LastName = 'Davolio' AND FirstName = 'Nancy' )", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT FirstName, LastName FROM Employees WHERE EmployeeID = ( SELECT ReportsTo FROM Employees WHERE LastName = 'Davolio' AND FirstName = 'Nancy' )", "index": 3101, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n City text, -- example: ['Berlin', 'México D.F.']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_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:\nto whom refers to ReportsTo; full name = FirstName, LastName;\nTo whom does Nancy Davolio report? Please give that employee's full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest salary refers to MAX(Salary); full name = FirstName, LastName;\nWhich employee has the highest salary? Please give his or her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT FirstName, LastName FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees )", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT FirstName, LastName FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees )", "index": 3102, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest salary refers to MAX(Salary); full name = FirstName, LastName;\nWhich employee has the highest salary? Please give his or her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n Country text, -- example: ['Japan', 'UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the products refers to ProductName; Japan refers to Country = 'Japan';\nPlease list the names of all the products whose supplier is in Japan.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'Japan'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'Japan'", "index": 3103, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n Country text, -- example: ['Japan', 'UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the products refers to ProductName; Japan refers to Country = 'Japan';\nPlease list the names of all the products whose supplier is in Japan.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['USA', 'UK']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['USA', 'Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\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:\nno longer continuous refers to Discontinued = 1; USA refers to Country = 'USA';\nAmong the products that are no longer in continuous production, how many of them have their supplier in the USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.Discontinued) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'USA' AND T1.Discontinued = 1", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT COUNT(T1.Discontinued) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'USA' AND T1.Discontinued = 1", "index": 3104, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['USA', 'UK']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['USA', 'Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\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:\nno longer continuous refers to Discontinued = 1; USA refers to Country = 'USA';\nAmong the products that are no longer in continuous production, how many of them have their supplier in the USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\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 = FirstName, LastName; youngest refers to latest BirthDate;\nGive the full name of the youngest employee.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT FirstName, LastName FROM Employees WHERE BirthDate = ( SELECT MAX(BirthDate) FROM Employees )", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT FirstName, LastName FROM Employees WHERE BirthDate = ( SELECT MAX(BirthDate) FROM Employees )", "index": 3105, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\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 = FirstName, LastName; youngest refers to latest BirthDate;\nGive the full name of the youngest employee.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnewest hired refers to latest HireDate; full name = FirstName, LastName;\nWho is the newest hired employee? Give the full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT FirstName, LastName FROM Employees WHERE HireDate = ( SELECT MAX(HireDate) FROM Employees )", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT FirstName, LastName FROM Employees WHERE HireDate = ( SELECT MAX(HireDate) FROM Employees )", "index": 3106, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnewest hired refers to latest HireDate; full name = FirstName, LastName;\nWho is the newest hired employee? Give the full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Suyama', 'Davolio', 'Fuller']\n FirstName text, -- example: ['Michael', 'Nancy', 'Andrew']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProvide the number of orders that were handled by Michael Suyama.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Michael' AND T1.LastName = 'Suyama'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT COUNT(T2.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Michael' AND T1.LastName = 'Suyama'", "index": 3107, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Suyama', 'Davolio', 'Fuller']\n FirstName text, -- example: ['Michael', 'Nancy', 'Andrew']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProvide the number of orders that were handled by Michael Suyama.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Tofu', 'Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_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:\ncategory refers to CategoryName; tofu refers to ProductName = 'Tofu';\nWhich category does \"tofu\" belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.CategoryName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.ProductName = 'Tofu'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT T2.CategoryName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.ProductName = 'Tofu'", "index": 3108, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Tofu', 'Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_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:\ncategory refers to CategoryName; tofu refers to ProductName = 'Tofu';\nWhich category does \"tofu\" belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Gudbrandsdalsost', 'Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduct refers to ProductName\nGive the contact name of the supplier for the product \"Gudbrandsdalsost\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Gudbrandsdalsost'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Gudbrandsdalsost'", "index": 3109, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Gudbrandsdalsost', 'Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduct refers to ProductName\nGive the contact name of the supplier for the product \"Gudbrandsdalsost\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Scottish Longbreads', 'Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n PRIMARY KEY (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Scottish Longbreads\" refers to ProductName = 'Scottish Longbreads'\nTell the country name of the supplier for \"Scottish Longbreads\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.Country FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Scottish Longbreads'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT T2.Country FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Scottish Longbreads'", "index": 3110, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Scottish Longbreads', 'Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n PRIMARY KEY (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Scottish Longbreads\" refers to ProductName = 'Scottish Longbreads'\nTell the country name of the supplier for \"Scottish Longbreads\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest number refers to max(count(CustomerID))\nHow many customers are there in the country with the highest number of customers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(CustomerID) FROM Customers GROUP BY Country ORDER BY COUNT(CustomerID) DESC LIMIT 1", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT COUNT(CustomerID) FROM Customers GROUP BY Country ORDER BY COUNT(CustomerID) DESC LIMIT 1", "index": 3111, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest number refers to max(count(CustomerID))\nHow many customers are there in the country with the highest number of customers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\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 refers to FirstName LastName; highest salary refers to max(Salary)\nWhat is the full name of the employee with the highest salary?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT FirstName, LastName FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees )", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT FirstName, LastName FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees )", "index": 3112, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\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 refers to FirstName LastName; highest salary refers to max(Salary)\nWhat is the full name of the employee with the highest salary?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n City text, -- example: ['Berlin', 'México D.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:\norder 10521 refers to OrderID = 10521; CustomerID = 'CACTU'; family name refers to LastName;\nWhat is the family name of the employee who shipped the order 10521 to CACTU?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10521 AND T2.CustomerID = 'CACTU'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10521 AND T2.CustomerID = 'CACTU'", "index": 3113, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n City text, -- example: ['Berlin', 'México D.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:\norder 10521 refers to OrderID = 10521; CustomerID = 'CACTU'; family name refers to LastName;\nWhat is the family name of the employee who shipped the order 10521 to CACTU?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LastName text, -- example: ['Davolio', 'Fuller']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproducts belong to beverage category refer to ProductName where CategoryName = 'beverage';\nWhat are the products that belong to the beverage category?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.ProductName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.CategoryName = 'Beverages'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT T2.ProductName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.CategoryName = 'Beverages'", "index": 3114, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LastName text, -- example: ['Davolio', 'Fuller']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproducts belong to beverage category refer to ProductName where CategoryName = 'beverage';\nWhat are the products that belong to the beverage category?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Tofu', 'Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\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 ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_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:\ntofu is the name of the product;\nWhat is the description of the category that tofu belongs to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Description FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.ProductName = 'tofu'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT T1.Description FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.ProductName = 'tofu'", "index": 3115, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Tofu', 'Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\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 ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_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:\ntofu is the name of the product;\nWhat is the description of the category that tofu belongs to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n PostalCode text, -- example: ['12209', '5021']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Camembert Pierrot', 'Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCamembert Pierrot is the name of the product; person to contact refers to ContactName;\nWho is the person to contact to get Camembert Pierrot?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Camembert Pierrot'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Camembert Pierrot'", "index": 3116, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n PostalCode text, -- example: ['12209', '5021']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Camembert Pierrot', 'Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCamembert Pierrot is the name of the product; person to contact refers to ContactName;\nWho is the person to contact to get Camembert Pierrot?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Meat/Poultry', 'Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\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:\nthree products that have been discontinued refer to ProductName LIMIT 3 where Discontinued = 1; CategoryName = 'Meat/Poultry';\nPlease name any three products that have been discontinued in the meat or poultry category.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.ProductName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.Discontinued = 1 AND T1.CategoryName = 'Meat/Poultry' LIMIT 3", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT T2.ProductName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.Discontinued = 1 AND T1.CategoryName = 'Meat/Poultry' LIMIT 3", "index": 3117, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Meat/Poultry', 'Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\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:\nthree products that have been discontinued refer to ProductName LIMIT 3 where Discontinued = 1; CategoryName = 'Meat/Poultry';\nPlease name any three products that have been discontinued in the meat or poultry category.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n City text, -- example: ['Berlin', 'México D.F.']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nID 1 to 9 refers to EmployeeID BETWEEN 1 AND 9; Average salary = AVG(Salary)\nWhat is the average salary for employees from ID 1 to 9?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(Salary) FROM Employees WHERE EmployeeID BETWEEN 1 AND 9", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT AVG(Salary) FROM Employees WHERE EmployeeID BETWEEN 1 AND 9", "index": 3118, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n City text, -- example: ['Berlin', 'México D.F.']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nID 1 to 9 refers to EmployeeID BETWEEN 1 AND 9; Average salary = AVG(Salary)\nWhat is the average salary for employees from ID 1 to 9?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n PostalCode text, -- example: ['12209', '5021']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n PRIMARY KEY (CategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest salary refers to Max(Salary)\nWrite down the notes of employee with the highest salary.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Notes FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees )", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT Notes FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees )", "index": 3119, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n PostalCode text, -- example: ['12209', '5021']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n PRIMARY KEY (CategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest salary refers to Max(Salary)\nWrite down the notes of employee with the highest salary.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LastName text, -- example: ['Suyama', 'Davolio', 'Fuller']\n FirstName text, -- example: ['Michael', 'Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList down the customer ids who placed order with Michael Suyama.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CustomerID FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Michael' AND T1.LastName = 'Suyama'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT T2.CustomerID FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Michael' AND T1.LastName = 'Suyama'", "index": 3120, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LastName text, -- example: ['Suyama', 'Davolio', 'Fuller']\n FirstName text, -- example: ['Michael', 'Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList down the customer ids who placed order with Michael Suyama.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LastName text, -- example: ['Fuller', 'Davolio']\n FirstName text, -- example: ['Andrew', 'Nancy']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n City text, -- example: ['Berlin', 'México D.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:\naverage salary = AVG(Salary)\nCalculate the average salary per order for Andrew Fuller.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(T1.Salary) AS REAL) / COUNT(T2.EmployeeID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Andrew' AND T1.LastName = 'Fuller'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT CAST(SUM(T1.Salary) AS REAL) / COUNT(T2.EmployeeID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Andrew' AND T1.LastName = 'Fuller'", "index": 3121, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LastName text, -- example: ['Fuller', 'Davolio']\n FirstName text, -- example: ['Andrew', 'Nancy']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n City text, -- example: ['Berlin', 'México D.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:\naverage salary = AVG(Salary)\nCalculate the average salary per order for Andrew Fuller.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Teatime Chocolate Biscuits', 'Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Teatime Chocolate Biscuits\" is the ProductName\nWhat is the contact name for product Teatime Chocolate Biscuits?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Teatime Chocolate Biscuits'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Teatime Chocolate Biscuits'", "index": 3122, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Teatime Chocolate Biscuits', 'Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Teatime Chocolate Biscuits\" is the ProductName\nWhat is the contact name for product Teatime Chocolate Biscuits?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndiscontinued refers to Discontinued = 1\nAmong the products, how many of them were discontinued in production?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Products WHERE Discontinued = 1", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT COUNT(*) FROM Products WHERE Discontinued = 1", "index": 3123, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndiscontinued refers to Discontinued = 1\nAmong the products, how many of them were discontinued in production?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n PRIMARY KEY (CategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nless than 4 territories refers to EmployeeID where Count(TerritoryID) < 4\nAmong the employees, give me the full names of those who have less than 4 territories.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.EmployeeID < 4", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.EmployeeID < 4", "index": 3124, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n PRIMARY KEY (CategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nless than 4 territories refers to EmployeeID where Count(TerritoryID) < 4\nAmong the employees, give me the full names of those who have less than 4 territories.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Anne', 'Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n PostalCode text, -- example: ['12209', '5021']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\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 territories are owned by Anne Dodsworth?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.TerritoryID) FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Anne' AND T1.LastName = 'Dodsworth'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT COUNT(T2.TerritoryID) FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Anne' AND T1.LastName = 'Dodsworth'", "index": 3125, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Anne', 'Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n PostalCode text, -- example: ['12209', '5021']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\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 territories are owned by Anne Dodsworth?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_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 salary refers to Max(Salary)\nWho has the highest salary? Please give their first name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT FirstName, LastName FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees )", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT FirstName, LastName FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees )", "index": 3126, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_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 salary refers to Max(Salary)\nWho has the highest salary? Please give their first name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Fuller', 'Davolio']\n FirstName text, -- example: ['Andrew', 'Nancy']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Andrew Fuller\" refers to FirstName = 'Andrew' AND LastName = 'Fuller'; report to refers to ReportsTo ! = NULL\nHow many employees report to Andrew Fuller?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(EmployeeID) FROM Employees WHERE ReportsTo = ( SELECT EmployeeID FROM Employees WHERE LastName = 'Fuller' AND FirstName = 'Andrew' )", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT COUNT(EmployeeID) FROM Employees WHERE ReportsTo = ( SELECT EmployeeID FROM Employees WHERE LastName = 'Fuller' AND FirstName = 'Andrew' )", "index": 3127, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Fuller', 'Davolio']\n FirstName text, -- example: ['Andrew', 'Nancy']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Andrew Fuller\" refers to FirstName = 'Andrew' AND LastName = 'Fuller'; report to refers to ReportsTo ! = NULL\nHow many employees report to Andrew Fuller?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\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:\nmajority of the suppliers located refers to MAX(COUNT(SupplierID))\nWhich country are the majority of the suppliers located?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Country FROM Suppliers GROUP BY Country ORDER BY COUNT(SupplierID) DESC LIMIT 1", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT Country FROM Suppliers GROUP BY Country ORDER BY COUNT(SupplierID) DESC LIMIT 1", "index": 3128, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\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:\nmajority of the suppliers located refers to MAX(COUNT(SupplierID))\nWhich country are the majority of the suppliers located?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAugust of 1996 refers to OrderDate = '1996-8'; highest amount of orders refers to MAX(COUNT(OrderID))\nIn August of 1996, how many orders were placed by the customer with the highest amount of orders?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(OrderID) FROM Orders WHERE OrderDate LIKE '1996-08%' GROUP BY CustomerID ORDER BY COUNT(OrderID) DESC LIMIT 1", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT COUNT(OrderID) FROM Orders WHERE OrderDate LIKE '1996-08%' GROUP BY CustomerID ORDER BY COUNT(OrderID) DESC LIMIT 1", "index": 3129, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAugust of 1996 refers to OrderDate = '1996-8'; highest amount of orders refers to MAX(COUNT(OrderID))\nIn August of 1996, how many orders were placed by the customer with the highest amount of orders?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['Spain', 'UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Spain', 'Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncompany in Spain refers to Country = 'Spain'; product supplied refers to ProductName\nWhat were the products supplied by the company in Spain?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'Spain'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'Spain'", "index": 3130, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['Spain', 'UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Spain', 'Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncompany in Spain refers to Country = 'Spain'; product supplied refers to ProductName\nWhat were the products supplied by the company in Spain?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Ireland', 'Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin Ireland refers to Country = 'Ireland';\nHow many orders were made by the customers in Ireland.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.OrderID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Country = 'Ireland'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT COUNT(T2.OrderID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Country = 'Ireland'", "index": 3131, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Ireland', 'Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin Ireland refers to Country = 'Ireland';\nHow many orders were made by the customers in Ireland.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\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 refers to FirstName, LastName; sales order with ID 10274 refers to OrderID = 10274\nProvide the full name of the employee who processed the sales order with ID 10274.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10274", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10274", "index": 3132, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\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 refers to FirstName, LastName; sales order with ID 10274 refers to OrderID = 10274\nProvide the full name of the employee who processed the sales order with ID 10274.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LastName text, -- example: ['Davolio', 'Fuller']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncompanies refers to ShipperID\nHow many companies do ship Northwind's orders?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(ShipperID) FROM Shippers", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT COUNT(ShipperID) FROM Shippers", "index": 3133, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 LastName text, -- example: ['Davolio', 'Fuller']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n PRIMARY KEY (ShipperID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncompanies refers to ShipperID\nHow many companies do ship Northwind's orders?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n PostalCode text, -- example: ['12209', '5021']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n City text, -- example: ['Londona', 'New Orleans']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Nancy', 'Andrew']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_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:\nSoft drinks, coffees, teas, beers, and ales' is Description of CategoryName\nIndicate category name of soft drinks, coffees, teas, beers, and ales in description 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 CategoryName FROM Categories WHERE Description = 'Soft drinks, coffees, teas, beers, and ales'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT CategoryName FROM Categories WHERE Description = 'Soft drinks, coffees, teas, beers, and ales'", "index": 3134, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n PostalCode text, -- example: ['12209', '5021']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n City text, -- example: ['Londona', 'New Orleans']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Nancy', 'Andrew']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_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:\nSoft drinks, coffees, teas, beers, and ales' is Description of CategoryName\nIndicate category name of soft drinks, coffees, teas, beers, and ales in description 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 Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Confections', 'Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n City text, -- example: ['Berlin', 'México D.F.']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n City text, -- example: ['Londona', 'New Orleans']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'Confections' is a CompanyName;\nList all product names under Confections.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.ProductName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.CategoryName = 'Confections'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT T1.ProductName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.CategoryName = 'Confections'", "index": 3135, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Confections', 'Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n City text, -- example: ['Berlin', 'México D.F.']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n City text, -- example: ['Londona', 'New Orleans']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'Confections' is a CompanyName;\nList all product names under Confections.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n Country text, -- example: ['UK', 'Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom UK refers to Country = 'UK'\nHow many suppliers are from UK?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(SupplierID) FROM Suppliers WHERE Country = 'UK'", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT COUNT(SupplierID) FROM Suppliers WHERE Country = 'UK'", "index": 3136, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n Country text, -- example: ['UK', 'Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom UK refers to Country = 'UK'\nHow many suppliers are from UK?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\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 product refers to ProductName; ID refers to ProductID\nWhat is the name of product with the ID of 77?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT ProductName FROM Products WHERE ProductID = 77", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT ProductName FROM Products WHERE ProductID = 77", "index": 3137, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\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 product refers to ProductName; ID refers to ProductID\nWhat is the name of product with the ID of 77?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\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:\nterritory ID from 1000 to 2000 refers to TerritoryID BETWEEN 1000 and 2000\nProvide employees' ID who are in-charge of territory ID 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 EmployeeID FROM EmployeeTerritories WHERE TerritoryID BETWEEN 1000 AND 2000", "style": "rule" }
{ "db_id": "retail_world.sqlite", "gt_sql": "SELECT EmployeeID FROM EmployeeTerritories WHERE TerritoryID BETWEEN 1000 AND 2000", "index": 3138, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n CategoryID integer, -- example: [1, 2]\n CategoryName text, -- example: ['Beverages', 'Condiments']\n Description text, -- example: ['Soft drinks, coffees, teas, beers, and a', 'Sweet and savory sauces, relishes, sprea']\n PRIMARY KEY (CategoryID)\n);\n\nCREATE TABLE Suppliers (\n SupplierID integer, -- example: [1, 2]\n SupplierName text, -- example: ['Exotic Liquid', 'New Orleans Cajun Delights']\n ContactName text, -- example: ['Charlotte Cooper', 'Shelley Burke']\n Address text, -- example: ['49 Gilbert St.', 'P.O. Box 78934']\n City text, -- example: ['Londona', 'New Orleans']\n PostalCode text, -- example: ['EC1 4SD', '70117']\n Country text, -- example: ['UK', 'USA']\n Phone text, -- example: ['(171) 555-2222', '(100) 555-4822']\n PRIMARY KEY (SupplierID)\n);\n\nCREATE TABLE Employees (\n EmployeeID integer, -- example: [1, 2]\n LastName text, -- example: ['Davolio', 'Fuller']\n FirstName text, -- example: ['Nancy', 'Andrew']\n BirthDate date, -- example: ['1968-12-08', '1952-02-19']\n Photo text, -- example: ['EmpID1.pic', 'EmpID2.pic']\n Notes text, -- example: ['Education includes a BA in psychology fr', 'Andrew received his BTS commercial and a']\n PRIMARY KEY (EmployeeID)\n);\n\nCREATE TABLE OrderDetails (\n OrderDetailID integer, -- example: [1, 2]\n OrderID integer, -- example: [10248, 10249]\n ProductID integer, -- example: [11, 42]\n Quantity integer, -- example: [12, 10]\n PRIMARY KEY (OrderDetailID),\n CONSTRAINT fk_orderdetails_orderid FOREIGN KEY (OrderID) REFERENCES Orders (OrderID),\n CONSTRAINT fk_orderdetails_productid FOREIGN KEY (ProductID) REFERENCES Products (ProductID)\n);\n\nCREATE TABLE Orders (\n OrderID integer, -- example: [10248, 10249]\n CustomerID integer, -- example: [90, 81]\n EmployeeID integer, -- example: [5, 6]\n OrderDate datetime, -- example: ['1996-07-04', '1996-07-05']\n ShipperID integer, -- example: [3, 1]\n PRIMARY KEY (OrderID),\n CONSTRAINT fk_orders_customerid FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),\n CONSTRAINT fk_orders_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID),\n CONSTRAINT fk_orders_shipperid FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID)\n);\n\nCREATE TABLE Products (\n ProductID integer, -- example: [1, 2]\n ProductName text, -- example: ['Chais', 'Chang']\n SupplierID integer, -- example: [1, 2]\n CategoryID integer, -- example: [1, 2]\n Unit text, -- example: ['10 boxes x 20 bags', '24 - 12 oz bottles']\n Price real, -- example: [18.0, 19.0]\n PRIMARY KEY (ProductID),\n CONSTRAINT fk_products_supplierid FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),\n CONSTRAINT fk_products_categoryid FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID)\n);\n\nCREATE TABLE Shippers (\n ShipperID integer, -- example: [1, 2]\n ShipperName text, -- example: ['Speedy Express', 'United Package']\n Phone text, -- example: ['(503) 555-9831', '(503) 555-3199']\n PRIMARY KEY (ShipperID)\n);\n\nCREATE TABLE Customers (\n CustomerID integer, -- example: [1, 2]\n CustomerName text, -- example: ['Alfreds Futterkiste', 'Ana Trujillo Emparedados y helados']\n ContactName text, -- example: ['Maria Anders', 'Ana Trujillo']\n Address text, -- example: ['Obere Str. 57', 'Avda. de la Constitución 2222']\n City text, -- example: ['Berlin', 'México D.F.']\n PostalCode text, -- example: ['12209', '5021']\n Country text, -- example: ['Germany', 'Mexico']\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:\nterritory ID from 1000 to 2000 refers to TerritoryID BETWEEN 1000 and 2000\nProvide employees' ID who are in-charge of territory ID 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 orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['R', 'N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreturned refer to l_returnflag = 'R'; order no.5 refers to l_orderkey = 5; kinds of items refer to l_linenumber;\nHow many kinds of items are returned in order no.5?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(l_linenumber) FROM lineitem WHERE l_orderkey = 5 AND l_returnflag = 'R'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(l_linenumber) FROM lineitem WHERE l_orderkey = 5 AND l_returnflag = 'R'", "index": 3139, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['R', 'N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreturned refer to l_returnflag = 'R'; order no.5 refers to l_orderkey = 5; kinds of items refer to l_linenumber;\nHow many kinds of items are returned in order no.5?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['HOUSEHOLD', 'BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norders in household segment refer to o_orderkey where c_mktsegment = 'HOUSEHOLD'; the highest total price refers to MAX(o_totalprice);\nAmong all the orders made by a customer in the household segment, what is the highest total 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 MAX(T1.o_totalprice) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'HOUSEHOLD'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT MAX(T1.o_totalprice) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'HOUSEHOLD'", "index": 3140, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['HOUSEHOLD', 'BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norders in household segment refer to o_orderkey where c_mktsegment = 'HOUSEHOLD'; the highest total price refers to MAX(o_totalprice);\nAmong all the orders made by a customer in the household segment, what is the highest total 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 customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\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 refers to c_name; single order with the highest total price refers to MAX(o_totalprice) LIMIT 1;\nPlease give the name of the customer who has made the single order with the highest total 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 T2.c_name FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey ORDER BY T1.o_totalprice DESC LIMIT 1", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T2.c_name FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey ORDER BY T1.o_totalprice DESC LIMIT 1", "index": 3141, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\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 refers to c_name; single order with the highest total price refers to MAX(o_totalprice) LIMIT 1;\nPlease give the name of the customer who has made the single order with the highest total 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 supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['HOUSEHOLD', 'BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['BRAZIL', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nphone numbers refer to c_phone; Brazil is the name of the nation which refers to n_name = 'BRAZIL'; household segment refers to c_mktsegment = 'HOUSEHOLD';\nPlease list the phone numbers of all the customers in the household segment and are in Brazil.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.c_phone FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_mktsegment = 'HOUSEHOLD' AND T2.n_name = 'BRAZIL'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T1.c_phone FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_mktsegment = 'HOUSEHOLD' AND T2.n_name = 'BRAZIL'", "index": 3142, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['HOUSEHOLD', 'BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['BRAZIL', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nphone numbers refer to c_phone; Brazil is the name of the nation which refers to n_name = 'BRAZIL'; household segment refers to c_mktsegment = 'HOUSEHOLD';\nPlease list the phone numbers of all the customers in the household segment and are in Brazil.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['GERMANY', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norders refer to o_orderkey; Germany is the name of the nation which refers to n_name = 'GERMANY';\nHow many orders in total are made by customers in Germany?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.c_custkey) FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN orders AS T3 ON T2.c_custkey = T3.o_custkey WHERE T1.n_name = 'GERMANY'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T2.c_custkey) FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN orders AS T3 ON T2.c_custkey = T3.o_custkey WHERE T1.n_name = 'GERMANY'", "index": 3143, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['GERMANY', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norders refer to o_orderkey; Germany is the name of the nation which refers to n_name = 'GERMANY';\nHow many orders in total are made by customers in Germany?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['GERMANY', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norders refer to o_orderkey; Germany is the name of the nation which refers to n_name = 'GERMANY'; earlier orderdate have higher priority in delivery therefore MIN(o_orderdate);\nAmong the orders made by customers in Germany, which one of them has the highest priority in delivery? Please give its order key.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.o_orderkey FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN orders AS T3 ON T2.c_custkey = T3.o_custkey WHERE T1.n_name = 'GERMANY' ORDER BY T3.o_orderdate LIMIT 1", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T3.o_orderkey FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN orders AS T3 ON T2.c_custkey = T3.o_custkey WHERE T1.n_name = 'GERMANY' ORDER BY T3.o_orderdate LIMIT 1", "index": 3144, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['GERMANY', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norders refer to o_orderkey; Germany is the name of the nation which refers to n_name = 'GERMANY'; earlier orderdate have higher priority in delivery therefore MIN(o_orderdate);\nAmong the orders made by customers in Germany, which one of them has the highest priority in delivery? Please give its order key.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['GERMANY', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(c_custkey when n_name = 'GERMANY'), COUNT(c_custkey)) as percentage;\nAmong all the customers, what is the percentage of the customer's nation being Germany?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.n_name = 'GERMANY', 1, 0)) AS REAL) * 100 / COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T2.n_name = 'GERMANY', 1, 0)) AS REAL) * 100 / COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey", "index": 3145, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['GERMANY', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(c_custkey when n_name = 'GERMANY'), COUNT(c_custkey)) as percentage;\nAmong all the customers, what is the percentage of the customer's nation being Germany?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsupplier No.34 refers to s_suppkey = 34; country refers to n_name;\nWhich country does supplier No.34 come from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_suppkey = 34", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_suppkey = 34", "index": 3146, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsupplier No.34 refers to s_suppkey = 34; country refers to n_name;\nWhich country does supplier No.34 come from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000129', 'Supplier#000000101', 'Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Supplier#000000129\" is the name of the supplier which refers to s_name; Which region refers to r_name;\nWhich region does \"Supplier#000000129\" belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.r_name FROM nation AS T1 INNER JOIN supplier AS T2 ON T1.n_nationkey = T2.s_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey WHERE T2.s_name = 'Supplier#000000129'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T3.r_name FROM nation AS T1 INNER JOIN supplier AS T2 ON T1.n_nationkey = T2.s_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey WHERE T2.s_name = 'Supplier#000000129'", "index": 3147, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000129', 'Supplier#000000101', 'Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Supplier#000000129\" is the name of the supplier which refers to s_name; Which region refers to r_name;\nWhich region does \"Supplier#000000129\" belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000055', 'Customer#000000011', 'Customer#000000002', 'Customer#000000001']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Customer#000000055\" is the name of the customer which refers to c_name; nationality is the state of belonging to a particular country, therefore nationality refers to n_name;\nWhat is the nationality of \"Customer#000000055\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.n_name FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_name = 'Customer#000000055'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T2.n_name FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_name = 'Customer#000000055'", "index": 3148, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000055', 'Customer#000000011', 'Customer#000000002', 'Customer#000000001']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Customer#000000055\" is the name of the customer which refers to c_name; nationality is the state of belonging to a particular country, therefore nationality refers to n_name;\nWhat is the nationality of \"Customer#000000055\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000055', 'Customer#000000011', 'Customer#000000002', 'Customer#000000001']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Customer#000000055\" is the name of the customer which refers to c_name; region name refers to r_name;\nGive customer No.106936's region name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.r_name FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey WHERE T2.c_custkey = 106936", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T3.r_name FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey WHERE T2.c_custkey = 106936", "index": 3149, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000055', 'Customer#000000011', 'Customer#000000002', 'Customer#000000001']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Customer#000000055\" is the name of the customer which refers to c_name; region name refers to r_name;\nGive customer No.106936's region name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['MOROCCO', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naccount is in debt if c_acctbal < 0; Moroccan customers refer to c_name WHERE n_name = 'MOROCCO';\nGive the number of Moroccan customers whose account is in debt.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.c_name) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'MOROCCO' AND T1.c_acctbal < 0", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T1.c_name) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'MOROCCO' AND T1.c_acctbal < 0", "index": 3150, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['MOROCCO', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naccount is in debt if c_acctbal < 0; Moroccan customers refer to c_name WHERE n_name = 'MOROCCO';\nGive the number of Moroccan customers whose account is in debt.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['R', 'N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreturned item refers to l_returnflag = 'R'; supplier id refers to l_suppkey; order with the total price of 218195.43 refers to o_totalprice = 218195.43;\nFor the order with the total price of 218195.43, which supplier handled the returned item? Give the supplier id.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.l_suppkey FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_totalprice = 218195.43 AND T2.l_returnflag = 'R'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T2.l_suppkey FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_totalprice = 218195.43 AND T2.l_returnflag = 'R'", "index": 3151, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['R', 'N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreturned item refers to l_returnflag = 'R'; supplier id refers to l_suppkey; order with the total price of 218195.43 refers to o_totalprice = 218195.43;\nFor the order with the total price of 218195.43, which supplier handled the returned item? Give the supplier id.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-03-13', '1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000936', 'Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_shipmode text, -- line item ship mode, example: ['TRUCK', 'SHIP', 'RAIL']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMULTIPLY(MULTIPLY(l_extendedprice, SUBTRACT(1, l_discount)), SUM(1, l_tax)) WHERE o_clerk = 'Clerk#000000936', o_orderstatus = '4-NOT SPECIFIED', o_orderdate = '1995-03-13' AND l_shipmode = 'TRUCK';\nClerk#000000936 dealt with a \"Not Specified\" order on 1995/3/13, what was the charge for the part of the order shipped by truck?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.l_extendedprice * (1 - T2.l_discount) * (1 + T2.l_tax) AS num FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_clerk = 'Clerk#000000936' AND T2.l_shipmode = 'TRUCK' AND T1.o_orderstatus = '4-NOT SPECIFIED' AND T1.o_orderdate = '1995-03-13'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T2.l_extendedprice * (1 - T2.l_discount) * (1 + T2.l_tax) AS num FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_clerk = 'Clerk#000000936' AND T2.l_shipmode = 'TRUCK' AND T1.o_orderstatus = '4-NOT SPECIFIED' AND T1.o_orderdate = '1995-03-13'", "index": 3152, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-03-13', '1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000936', 'Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_shipmode text, -- line item ship mode, example: ['TRUCK', 'SHIP', 'RAIL']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMULTIPLY(MULTIPLY(l_extendedprice, SUBTRACT(1, l_discount)), SUM(1, l_tax)) WHERE o_clerk = 'Clerk#000000936', o_orderstatus = '4-NOT SPECIFIED', o_orderdate = '1995-03-13' AND l_shipmode = 'TRUCK';\nClerk#000000936 dealt with a \"Not Specified\" order on 1995/3/13, what was the charge for the part of the order shipped by truck?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1996-07-27', '1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1996-07-27', '1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1996-07-27', '1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(l_receiptdate, l_commitdate) WHERE o_orderdate = '1996-07-27' AND o_custkey = '129301';\nCustomer No.129301 made an order on 1996/7/27, what was the delivery time for the first part of that order?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT JULIANDAY(T2.l_receiptdate) - JULIANDAY(T2.l_commitdate) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_custkey = '129301' AND T1.o_orderdate = '1996-07-27'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT JULIANDAY(T2.l_receiptdate) - JULIANDAY(T2.l_commitdate) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_custkey = '129301' AND T1.o_orderdate = '1996-07-27'", "index": 3153, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1996-07-27', '1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1996-07-27', '1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1996-07-27', '1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(l_receiptdate, l_commitdate) WHERE o_orderdate = '1996-07-27' AND o_custkey = '129301';\nCustomer No.129301 made an order on 1996/7/27, what was the delivery time for the first part of that order?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1997-12-10', '1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_clerk text, -- order clerk, example: ['Clerk#000000803', 'Clerk#000000818', 'Clerk#000000916', 'Clerk#000000373']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\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 refers to c_name; o_clerk = 'Clerk#000000803'; order on 1997/12/10 refers to o_orderdate = '1997-12-10';\nGive the name of the customer who made an order with Clerk#000000803 on 1997/12/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 T2.c_name FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T1.o_orderdate = '1997-12-10' AND T1.o_clerk = 'Clerk#000000803'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T2.c_name FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T1.o_orderdate = '1997-12-10' AND T1.o_clerk = 'Clerk#000000803'", "index": 3154, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1997-12-10', '1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_clerk text, -- order clerk, example: ['Clerk#000000803', 'Clerk#000000818', 'Clerk#000000916', 'Clerk#000000373']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\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 refers to c_name; o_clerk = 'Clerk#000000803'; order on 1997/12/10 refers to o_orderdate = '1997-12-10';\nGive the name of the customer who made an order with Clerk#000000803 on 1997/12/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 part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(MULTIPLY(l_extendedprice, (SUBTRACT(1, l_discount)), MULTIPLY(ps_supplycost, l_quantity))) WHERE l_suppkey = 7414 AND l_orderkey = 817154;\nCalculates the profit processed by Supplier No. 7414 on order No. 817154.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.l_extendedprice * (1 - T1.l_discount) - T2.ps_supplycost * T1.l_quantity FROM lineitem AS T1 INNER JOIN partsupp AS T2 ON T1.l_suppkey = T2.ps_suppkey WHERE T1.l_suppkey = 7414 AND T1.l_orderkey = 817154", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T1.l_extendedprice * (1 - T1.l_discount) - T2.ps_supplycost * T1.l_quantity FROM lineitem AS T1 INNER JOIN partsupp AS T2 ON T1.l_suppkey = T2.ps_suppkey WHERE T1.l_suppkey = 7414 AND T1.l_orderkey = 817154", "index": 3155, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(MULTIPLY(l_extendedprice, (SUBTRACT(1, l_discount)), MULTIPLY(ps_supplycost, l_quantity))) WHERE l_suppkey = 7414 AND l_orderkey = 817154;\nCalculates the profit processed by Supplier No. 7414 on order No. 817154.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['EUROPE', 'AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(n_name where r_name = 'EUROPE'), COUNT(n_name)) as percentage;\nWhat is the percentage of the European countries among the given countries?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.r_name = 'EUROPE', 1, 0)) AS REAL) * 100 / COUNT(T1.n_name) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T2.r_name = 'EUROPE', 1, 0)) AS REAL) * 100 / COUNT(T1.n_name) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey", "index": 3156, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['EUROPE', 'AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(n_name where r_name = 'EUROPE'), COUNT(n_name)) as percentage;\nWhat is the percentage of the European countries among the given countries?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['JAPAN', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naccount is in debt if s_acctbal < 0; DIVIDE(COUNT(s_acctbal < 0 where n_name = 'JAPAN'), COUNT(s_name where n_name = 'JAPAN')) as percentage;\nGive the percentage of Japanese suppliers whose account is in debt.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.n_name = 'JAPAN', 1, 0)) AS REAL) * 100 / COUNT(T1.s_name) FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T2.n_name = 'JAPAN', 1, 0)) AS REAL) * 100 / COUNT(T1.s_name) FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0", "index": 3157, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['JAPAN', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naccount is in debt if s_acctbal < 0; DIVIDE(COUNT(s_acctbal < 0 where n_name = 'JAPAN'), COUNT(s_name where n_name = 'JAPAN')) as percentage;\nGive the percentage of Japanese suppliers whose account is in debt.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomer with the highest amount of debt refers to c_name where MIN(c_acctbal);\nWhat is the name of the customer with the highest amount of debt?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT c_name FROM customer WHERE c_acctbal = ( SELECT MIN(c_acctbal) FROM customer )", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT c_name FROM customer WHERE c_acctbal = ( SELECT MIN(c_acctbal) FROM customer )", "index": 3158, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomer with the highest amount of debt refers to c_name where MIN(c_acctbal);\nWhat is the name of the customer with the highest amount of debt?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest amount of extended price refers to MAX(l_extendedprice);\nWhat are the top 2 order keys of the item with the highest amount of extended 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 l_orderkey FROM lineitem ORDER BY l_extendedprice DESC LIMIT 2", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT l_orderkey FROM lineitem ORDER BY l_extendedprice DESC LIMIT 2", "index": 3159, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest amount of extended price refers to MAX(l_extendedprice);\nWhat are the top 2 order keys of the item with the highest amount of extended 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 lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['SHIP', 'RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhen shipped refers to l_shipdate; the highest amount of total price refers to MAX(o_totalprice);\nWhen was the order with the highest amount of total price shipped?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.l_shipdate FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey ORDER BY T1.o_totalprice DESC LIMIT 1", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T2.l_shipdate FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey ORDER BY T1.o_totalprice DESC LIMIT 1", "index": 3160, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['SHIP', 'RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhen shipped refers to l_shipdate; the highest amount of total price refers to MAX(o_totalprice);\nWhen was the order with the highest amount of total price shipped?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry refers to n_name; most of the customers refer to MAX(COUNT(c_custkey));\nIn which country do most of the customers come from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T.n_name FROM ( SELECT T2.n_name, COUNT(T1.c_custkey) AS num FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey GROUP BY T2.n_name ) AS T ORDER BY T.num DESC LIMIT 1", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T.n_name FROM ( SELECT T2.n_name, COUNT(T1.c_custkey) AS num FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey GROUP BY T2.n_name ) AS T ORDER BY T.num DESC LIMIT 1", "index": 3161, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry refers to n_name; most of the customers refer to MAX(COUNT(c_custkey));\nIn which country do most of the customers come from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['1-URGENT', '4-NOT SPECIFIED']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe order is urgent if o_orderpriority = '1-URGENT'; shipped the next day refers to SUBTRACT(l_shipdate, o_orderdate) = 1;\nHow many urgent orders were shipped the next 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 COUNT(T2.o_orderkey) FROM lineitem AS T1 INNER JOIN orders AS T2 ON T2.o_orderkey = T1.l_orderkey WHERE JULIANDAY(T1.l_shipdate) - JULIANDAY(T2.o_orderdate) = 1 AND T2.o_orderpriority = '1-URGENT'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T2.o_orderkey) FROM lineitem AS T1 INNER JOIN orders AS T2 ON T2.o_orderkey = T1.l_orderkey WHERE JULIANDAY(T1.l_shipdate) - JULIANDAY(T2.o_orderdate) = 1 AND T2.o_orderpriority = '1-URGENT'", "index": 3162, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['1-URGENT', '4-NOT SPECIFIED']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe order is urgent if o_orderpriority = '1-URGENT'; shipped the next day refers to SUBTRACT(l_shipdate, o_orderdate) = 1;\nHow many urgent orders were shipped the next 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 customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['JAPAN', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsuppliers refer to s_nationkey; Japan is the name of the nation which refers to n_name = 'JAPAN';\nHow many suppliers are from Japan?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'JAPAN'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'JAPAN'", "index": 3163, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['JAPAN', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsuppliers refer to s_nationkey; Japan is the name of the nation which refers to n_name = 'JAPAN';\nHow many suppliers are from Japan?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['UNITED STATES', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest number of customers refer to MAX(COUNT(c_custkey)); the United States is the name of the nation which refers to n_name = 'UNITED STATES'; market segment refers to c_mktsegment;\nAmong the customers from the United States, which market segment has the highest number of customers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T.c_mktsegment FROM ( SELECT T1.c_mktsegment, COUNT(T1.c_custkey) AS num FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'UNITED STATES' GROUP BY T1.c_mktsegment ) AS T ORDER BY T.num DESC LIMIT 1", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T.c_mktsegment FROM ( SELECT T1.c_mktsegment, COUNT(T1.c_custkey) AS num FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'UNITED STATES' GROUP BY T1.c_mktsegment ) AS T ORDER BY T.num DESC LIMIT 1", "index": 3164, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['UNITED STATES', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest number of customers refer to MAX(COUNT(c_custkey)); the United States is the name of the nation which refers to n_name = 'UNITED STATES'; market segment refers to c_mktsegment;\nAmong the customers from the United States, which market segment has the highest number of customers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['ASIA', 'AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountries in the region of Asia refer to n_name where r_name = 'ASIA';\nWhat are the countries in the region of Asia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.n_name FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey WHERE T2.r_name = 'ASIA'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T1.n_name FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey WHERE T2.r_name = 'ASIA'", "index": 3165, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['ASIA', 'AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountries in the region of Asia refer to n_name where r_name = 'ASIA';\nWhat are the countries in the region of Asia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#3', 'Manufacturer#2', 'Manufacturer#1', 'Manufacturer#5', 'Manufacturer#4']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the parts refer to p_name; manufacturer 3 refers to p_mfgr = 'Manufacturer#3'; ps_supplycost = 1000;\nWhat are the names of the parts manufactured by manufacturer 3 that have a supply cost of 1,000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.p_name FROM partsupp AS T1 INNER JOIN part AS T2 ON T1.ps_partkey = T2.p_partkey WHERE T1.ps_supplycost = 1000 AND T2.p_mfgr = 'Manufacturer#3'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T2.p_name FROM partsupp AS T1 INNER JOIN part AS T2 ON T1.ps_partkey = T2.p_partkey WHERE T1.ps_supplycost = 1000 AND T2.p_mfgr = 'Manufacturer#3'", "index": 3166, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#3', 'Manufacturer#2', 'Manufacturer#1', 'Manufacturer#5', 'Manufacturer#4']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the parts refer to p_name; manufacturer 3 refers to p_mfgr = 'Manufacturer#3'; ps_supplycost = 1000;\nWhat are the names of the parts manufactured by manufacturer 3 that have a supply cost of 1,000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['R', 'N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nr_comment = 'asymptotes sublate after the r'; countries refer to n_nationkey;\nHow many countries are there in the region whose comment description is \"asymptotes sublate after the r.\"\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.n_nationkey) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey WHERE T2.r_comment = 'asymptotes sublate after the r'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T1.n_nationkey) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey WHERE T2.r_comment = 'asymptotes sublate after the r'", "index": 3167, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['R', 'N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nr_comment = 'asymptotes sublate after the r'; countries refer to n_nationkey;\nHow many countries are there in the region whose comment description is \"asymptotes sublate after the r.\"\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1996-05-07', '1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_receiptdate date, -- line item receipt date, example: ['1996-05-07', '1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['DELIVER IN PERSON', 'NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['smoke turquoise purple blue salmon', 'burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(MULTIPLY(l_extendedprice, (SUBTRACT(1, l_discount)), MULTIPLY(ps_supplycost, l_quantity))) where p_name = 'smoke turquoise purple blue salmon' and l_receiptdate = '1996-05-07' and l_shipinstruct = 'DELIVER IN PERSON';\nHow much is the profit for smoke turquoise purple blue salmon that was delivered in person on 5/7/1996?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.l_extendedprice * (1 - T1.l_discount) - T2.ps_supplycost * T1.l_quantity AS num FROM lineitem AS T1 INNER JOIN partsupp AS T2 ON T1.l_suppkey = T2.ps_suppkey INNER JOIN part AS T3 ON T2.ps_partkey = T3.p_partkey WHERE T1.l_receiptdate = '1996-05-07' AND T1.l_shipinstruct = 'DELIVER IN PERSON' AND T3.p_name = 'smoke turquoise purple blue salmon'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T1.l_extendedprice * (1 - T1.l_discount) - T2.ps_supplycost * T1.l_quantity AS num FROM lineitem AS T1 INNER JOIN partsupp AS T2 ON T1.l_suppkey = T2.ps_suppkey INNER JOIN part AS T3 ON T2.ps_partkey = T3.p_partkey WHERE T1.l_receiptdate = '1996-05-07' AND T1.l_shipinstruct = 'DELIVER IN PERSON' AND T3.p_name = 'smoke turquoise purple blue salmon'", "index": 3168, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1996-05-07', '1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_receiptdate date, -- line item receipt date, example: ['1996-05-07', '1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['DELIVER IN PERSON', 'NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['smoke turquoise purple blue salmon', 'burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(MULTIPLY(l_extendedprice, (SUBTRACT(1, l_discount)), MULTIPLY(ps_supplycost, l_quantity))) where p_name = 'smoke turquoise purple blue salmon' and l_receiptdate = '1996-05-07' and l_shipinstruct = 'DELIVER IN PERSON';\nHow much is the profit for smoke turquoise purple blue salmon that was delivered in person on 5/7/1996?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(SUM(l_extendedprice), 10) where MAX(o_totalprice);\nWhat is the average price before discount of the top 10 orders with the highest total 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 SUM(T2.l_extendedprice) / 10 FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey ORDER BY T1.o_totalprice DESC LIMIT 10", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT SUM(T2.l_extendedprice) / 10 FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey ORDER BY T1.o_totalprice DESC LIMIT 10", "index": 3169, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(SUM(l_extendedprice), 10) where MAX(o_totalprice);\nWhat is the average price before discount of the top 10 orders with the highest total 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 partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1993-12-04', '1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitems shipped on 4th December, 1993 refer to l_linenumber where l_shipdate = '1993-12-04';\nHow many items were shipped on 4th December, 1993?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(l_linenumber) FROM lineitem WHERE l_shipdate = '1993-12-04'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(l_linenumber) FROM lineitem WHERE l_shipdate = '1993-12-04'", "index": 3170, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1993-12-04', '1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitems shipped on 4th December, 1993 refer to l_linenumber where l_shipdate = '1993-12-04';\nHow many items were shipped on 4th December, 1993?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(c_custkey where c_acctbal < 0), COUNT(c_custkey)) as percentage;\nCalculate the percentage of customers' accounts in debt.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(c_acctbal < 0, 1, 0)) AS REAL) * 100 / COUNT(c_custkey) FROM customer", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(c_acctbal < 0, 1, 0)) AS REAL) * 100 / COUNT(c_custkey) FROM customer", "index": 3171, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(c_custkey where c_acctbal < 0), COUNT(c_custkey)) as percentage;\nCalculate the percentage of customers' accounts in debt.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000021159', 'Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitems Customer#000021159 order refer to l_linenumber where c_name = 'Customer#000021159'; SUM(MULTIPLY(MULTIPLY(l_extendedprice, SUBTRACT(1, l_discount)), SUM(1, l_tax))) where c_name = 'Customer#000021159';\nHow many items did Customer#000021159 order? Calculate those items total charges.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.o_orderkey), SUM(T3.l_extendedprice * (1 - T3.l_discount) * (1 + T3.l_tax)) FROM customer AS T1 INNER JOIN orders AS T2 ON T1.c_custkey = T2.o_custkey INNER JOIN lineitem AS T3 ON T2.o_orderkey = T3.l_orderkey WHERE T1.c_name = 'Customer#000021159' GROUP BY T3.l_linenumber", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T2.o_orderkey), SUM(T3.l_extendedprice * (1 - T3.l_discount) * (1 + T3.l_tax)) FROM customer AS T1 INNER JOIN orders AS T2 ON T1.c_custkey = T2.o_custkey INNER JOIN lineitem AS T3 ON T2.o_orderkey = T3.l_orderkey WHERE T1.c_name = 'Customer#000021159' GROUP BY T3.l_linenumber", "index": 3172, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000021159', 'Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitems Customer#000021159 order refer to l_linenumber where c_name = 'Customer#000021159'; SUM(MULTIPLY(MULTIPLY(l_extendedprice, SUBTRACT(1, l_discount)), SUM(1, l_tax))) where c_name = 'Customer#000021159';\nHow many items did Customer#000021159 order? Calculate those items total charges.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['smoke red pale saddle plum', 'burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\np_name = 'smoke red pale saddle plum'; the suppliers' names refer to s_name;\nList the suppliers' names which supplied smoke red pale saddle plum.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.s_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T1.p_name = 'smoke red pale saddle plum'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T3.s_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T1.p_name = 'smoke red pale saddle plum'", "index": 3173, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['smoke red pale saddle plum', 'burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\np_name = 'smoke red pale saddle plum'; the suppliers' names refer to s_name;\nList the suppliers' names which supplied smoke red pale saddle plum.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['MIDDLE EAST', 'AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsuppliers from Middle East region refer to s_name where r_name = 'MIDDLE EAST'; in debt refers to s_acctbal < 0;\nAmong the suppliers from Middle East region, how many suppliers were in debt?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.s_name) FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey INNER JOIN supplier AS T3 ON T2.n_nationkey = T3.s_nationkey WHERE T3.s_acctbal < 0 AND T1.r_name = 'MIDDLE EAST'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T3.s_name) FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey INNER JOIN supplier AS T3 ON T2.n_nationkey = T3.s_nationkey WHERE T3.s_acctbal < 0 AND T1.r_name = 'MIDDLE EAST'", "index": 3174, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['MIDDLE EAST', 'AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsuppliers from Middle East region refer to s_name where r_name = 'MIDDLE EAST'; in debt refers to s_acctbal < 0;\nAmong the suppliers from Middle East region, how many suppliers were in debt?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000018', 'Supplier#000000011', 'Supplier#000000002', 'Supplier#000000001']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSupplier#000000018 is the name of supplier which refers to s_name; supply costs above 900 refer to ps_supplycost > 900;\nAmong the parts supplied by Supplier#000000018, provide parts names which had supply costs above 900.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.p_name FROM partsupp AS T1 INNER JOIN part AS T2 ON T1.ps_partkey = T2.p_partkey INNER JOIN supplier AS T3 ON T1.ps_suppkey = T3.s_suppkey WHERE T1.ps_supplycost > 900 AND T3.s_name = 'Supplier#000000018'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T2.p_name FROM partsupp AS T1 INNER JOIN part AS T2 ON T1.ps_partkey = T2.p_partkey INNER JOIN supplier AS T3 ON T1.ps_suppkey = T3.s_suppkey WHERE T1.ps_supplycost > 900 AND T3.s_name = 'Supplier#000000018'", "index": 3175, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000018', 'Supplier#000000011', 'Supplier#000000002', 'Supplier#000000001']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSupplier#000000018 is the name of supplier which refers to s_name; supply costs above 900 refer to ps_supplycost > 900;\nAmong the parts supplied by Supplier#000000018, provide parts names which had supply costs above 900.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'SHIP', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipped by rail refers to l_shipmode = 'RAIL'; quantity less than 30 refers to l_quantity < 30;\nHow many of the line items have been shipped by rail with a quantity less than 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 COUNT(l_linenumber) FROM lineitem WHERE l_quantity < 30 AND l_shipmode = 'RAIL'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(l_linenumber) FROM lineitem WHERE l_quantity < 30 AND l_shipmode = 'RAIL'", "index": 3176, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'SHIP', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipped by rail refers to l_shipmode = 'RAIL'; quantity less than 30 refers to l_quantity < 30;\nHow many of the line items have been shipped by rail with a quantity less than 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 nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nphone number of the customer refers to c_phone; the highest total price refers to MAX(o_totalprice);\nProvide the phone number of the customer with the highest total price in an order.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.c_phone FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey ORDER BY T1.o_totalprice DESC LIMIT 1", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T2.c_phone FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey ORDER BY T1.o_totalprice DESC LIMIT 1", "index": 3177, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nphone number of the customer refers to c_phone; the highest total price refers to MAX(o_totalprice);\nProvide the phone number of the customer with the highest total price in an order.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['wH55UnX7 VI', 'KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnation refers to n_name; region refers to r_name; address of wH55UnX7 VI refers to c_address = 'wH55UnX7 VI';\nProvide the nation and region of the customer with the address of wH55UnX7 VI?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.n_name, T3.r_name FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey WHERE T2.c_address = 'wH55UnX7 VI'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T1.n_name, T3.r_name FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey WHERE T2.c_address = 'wH55UnX7 VI'", "index": 3178, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['wH55UnX7 VI', 'KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnation refers to n_name; region refers to r_name; address of wH55UnX7 VI refers to c_address = 'wH55UnX7 VI';\nProvide the nation and region of the customer with the address of wH55UnX7 VI?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['BRAZIL', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomers refer to c_custkey; Brazil is the name of the nation which refers to n_name = 'BRAZIL'; account balance of less than 1000 refers to c_acctbal < 1000;\nAmong all the customers in Brazil, how many of them have an account balance of less than 1000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'BRAZIL' AND T1.c_acctbal < 1000", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'BRAZIL' AND T1.c_acctbal < 1000", "index": 3179, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['BRAZIL', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomers refer to c_custkey; Brazil is the name of the nation which refers to n_name = 'BRAZIL'; account balance of less than 1000 refers to c_acctbal < 1000;\nAmong all the customers in Brazil, how many of them have an account balance of less than 1000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsupply key refers to s_suppkey; the most amount account balance refers to MAX(s_acctbal);\nFind the supply key of the top ten suppliers with the most account balance, and list the supply key along with the account balance in descending order of account balance.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT s_suppkey, s_acctbal FROM supplier ORDER BY s_acctbal DESC LIMIT 10", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT s_suppkey, s_acctbal FROM supplier ORDER BY s_acctbal DESC LIMIT 10", "index": 3180, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsupply key refers to s_suppkey; the most amount account balance refers to MAX(s_acctbal);\nFind the supply key of the top ten suppliers with the most account balance, and list the supply key along with the account balance in descending order of account balance.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['1-URGENT', '4-NOT SPECIFIED']\n o_shippriority integer, -- order ship priority, example: [0]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomers who are not in debt refer to c_custkey where c_acctbal > 0; the order is urgent if o_orderpriority = '1-URGENT' ;\nHow many customers who are not in debt ordered an urgent order?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.c_custkey) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_acctbal > 0 AND T1.o_orderpriority = '1-URGENT'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T2.c_custkey) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_acctbal > 0 AND T1.o_orderpriority = '1-URGENT'", "index": 3181, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['1-URGENT', '4-NOT SPECIFIED']\n o_shippriority integer, -- order ship priority, example: [0]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomers who are not in debt refer to c_custkey where c_acctbal > 0; the order is urgent if o_orderpriority = '1-URGENT' ;\nHow many customers who are not in debt ordered an urgent order?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['AUTOMOBILE', 'BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['FRANCE', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(c_name where c_mktsegment = 'AUTOMOBILE' and n_name = 'FRANCE'), COUNT(c_name where n_name = 'FRANCE')) as percentage;\nWhat percentage of customers from France is in the automobile segment?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(IIF(T1.c_mktsegment = 'AUTOMOBILE', 1, 0)) AS REAL) * 100 / COUNT(T1.c_name) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'FRANCE'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T1.c_mktsegment = 'AUTOMOBILE', 1, 0)) AS REAL) * 100 / COUNT(T1.c_name) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'FRANCE'", "index": 3182, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['AUTOMOBILE', 'BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['FRANCE', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(c_name where c_mktsegment = 'AUTOMOBILE' and n_name = 'FRANCE'), COUNT(c_name where n_name = 'FRANCE')) as percentage;\nWhat percentage of customers from France is in the automobile segment?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe names of countries with the below-average number of customers refer to n_name where COUNT(c_name) < DIVIDE(COUNT(c_name)), COUNT(n_name);\nList the names of the countries with the below-average number of customers in ascending order of customer numbers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.n_name FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey GROUP BY T2.n_name HAVING COUNT(T1.c_name) > ( SELECT COUNT(customer.c_name) / COUNT(DISTINCT nation.n_name) FROM customer INNER JOIN nation ON customer.c_nationkey = nation.n_nationkey ) ORDER BY COUNT(T1.c_name)", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T2.n_name FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey GROUP BY T2.n_name HAVING COUNT(T1.c_name) > ( SELECT COUNT(customer.c_name) / COUNT(DISTINCT nation.n_name) FROM customer INNER JOIN nation ON customer.c_nationkey = nation.n_nationkey ) ORDER BY COUNT(T1.c_name)", "index": 3183, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe names of countries with the below-average number of customers refer to n_name where COUNT(c_name) < DIVIDE(COUNT(c_name)), COUNT(n_name);\nList the names of the countries with the below-average number of customers in ascending order of customer numbers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['HOUSEHOLD', 'BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(c_custkey where c_mktsegment = 'HOUSEHOLD' and r_name = 'AFRICA'), COUNT(c_custkey where r_name = 'AFRICA')) as percentage;\nWhat percentage of customers from the African region is in the household segment?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.r_name = 'AFRICA', 1, 0)) AS REAL) * 100 / COUNT(T1.n_nationkey) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey INNER JOIN customer AS T3 ON T1.n_nationkey = T3.c_nationkey WHERE T3.c_mktsegment = 'HOUSEHOLD'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T2.r_name = 'AFRICA', 1, 0)) AS REAL) * 100 / COUNT(T1.n_nationkey) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey INNER JOIN customer AS T3 ON T1.n_nationkey = T3.c_nationkey WHERE T3.c_mktsegment = 'HOUSEHOLD'", "index": 3184, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['HOUSEHOLD', 'BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(c_custkey where c_mktsegment = 'HOUSEHOLD' and r_name = 'AFRICA'), COUNT(c_custkey where r_name = 'AFRICA')) as percentage;\nWhat percentage of customers from the African region is in the household segment?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitems with the most quantity available refer to p_name where MAX(ps_availqty);\nList the name of the top ten items with the most quantity available in the descending order of availability.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.p_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey ORDER BY T2.ps_availqty DESC LIMIT 10", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T1.p_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey ORDER BY T2.ps_availqty DESC LIMIT 10", "index": 3185, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitems with the most quantity available refer to p_name where MAX(ps_availqty);\nList the name of the top ten items with the most quantity available in the descending order of availability.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['3-MEDIUM', '4-NOT SPECIFIED', '1-URGENT']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'SHIP', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nparts shipped by rail refer to l_partkey where l_shipmode = 'RAIL'; medium priority refers to o_orderpriority = '3-MEDIUM';\nIn the parts shipped by rail, how many are of medium priority?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.l_partkey) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T2.l_shipmode = 'RAIL' AND T1.o_orderpriority = '3-MEDIUM'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T2.l_partkey) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T2.l_shipmode = 'RAIL' AND T1.o_orderpriority = '3-MEDIUM'", "index": 3186, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['3-MEDIUM', '4-NOT SPECIFIED', '1-URGENT']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'SHIP', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nparts shipped by rail refer to l_partkey where l_shipmode = 'RAIL'; medium priority refers to o_orderpriority = '3-MEDIUM';\nIn the parts shipped by rail, how many are of medium priority?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_shipmode text, -- line item ship mode, example: ['TRUCK', 'SHIP', 'RAIL']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['5-LOW', '4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(DIVIDE(SUM(l_orderkey where year(l_shipdate) = 1995), 12), DIVIDE(SUM(l_orderkey where year(l_shipdate) = 1996), 12)) where o_orderpriority = '5-LOW';\nCalculate the difference in the average number of low-priority orders shipped by truck in each month of 1995 and 1996.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT (CAST(SUM(IIF(STRFTIME('%Y', T2.l_shipdate) = 1995, 1, 0)) AS REAL) / 12) - (CAST(SUM(IIF(STRFTIME('%Y', T2.l_shipdate) = 1996, 1, 0)) AS REAL) / 12) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_orderpriority = '5-LOW' AND T2.l_shipmode = 'TRUCK'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT (CAST(SUM(IIF(STRFTIME('%Y', T2.l_shipdate) = 1995, 1, 0)) AS REAL) / 12) - (CAST(SUM(IIF(STRFTIME('%Y', T2.l_shipdate) = 1996, 1, 0)) AS REAL) / 12) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_orderpriority = '5-LOW' AND T2.l_shipmode = 'TRUCK'", "index": 3187, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_shipmode text, -- line item ship mode, example: ['TRUCK', 'SHIP', 'RAIL']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['5-LOW', '4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(DIVIDE(SUM(l_orderkey where year(l_shipdate) = 1995), 12), DIVIDE(SUM(l_orderkey where year(l_shipdate) = 1996), 12)) where o_orderpriority = '5-LOW';\nCalculate the difference in the average number of low-priority orders shipped by truck in each month of 1995 and 1996.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norder number refers to l_orderkey; the lowest price after applying the discount refers to MIN(MULTIPLY(l_extendedprice), SUBTRACT(1, l_discount));\nList by order number the 3 items with the lowest price after applying the discount.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT l_orderkey FROM lineitem ORDER BY l_extendedprice * (1 - l_discount) LIMIT 3", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT l_orderkey FROM lineitem ORDER BY l_extendedprice * (1 - l_discount) LIMIT 3", "index": 3188, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norder number refers to l_orderkey; the lowest price after applying the discount refers to MIN(MULTIPLY(l_extendedprice), SUBTRACT(1, l_discount));\nList by order number the 3 items with the lowest price after applying the discount.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['R', 'N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than 10 items have been returned refer to l_returnflag = 'R' where l_quantity > 10; orders refer to l_orderkey;\nHow many orders of more than 10 items have been returned?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(l_linenumber) FROM lineitem WHERE l_quantity > 10 AND l_returnflag = 'R'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(l_linenumber) FROM lineitem WHERE l_quantity > 10 AND l_returnflag = 'R'", "index": 3189, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['R', 'N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than 10 items have been returned refer to l_returnflag = 'R' where l_quantity > 10; orders refer to l_orderkey;\nHow many orders of more than 10 items have been returned?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['1-URGENT', '4-NOT SPECIFIED']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nan urgent priority order refers to o_orderkey where o_orderpriority = '1-URGENT'; earlier orderdate have higher priority in delivery; lower delivery priority refers to MAX(o_orderdate);\nOf the orders with a lower delivery priority, how many have an urgent priority order?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(o_orderkey) FROM orders WHERE o_orderpriority = '1-URGENT' GROUP BY o_orderdate ORDER BY o_orderdate DESC LIMIT 1", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(o_orderkey) FROM orders WHERE o_orderpriority = '1-URGENT' GROUP BY o_orderdate ORDER BY o_orderdate DESC LIMIT 1", "index": 3190, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['1-URGENT', '4-NOT SPECIFIED']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nan urgent priority order refers to o_orderkey where o_orderpriority = '1-URGENT'; earlier orderdate have higher priority in delivery; lower delivery priority refers to MAX(o_orderdate);\nOf the orders with a lower delivery priority, how many have an urgent priority order?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['EGYPT', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsuppliers refer to s_suppkey; Egypt is the name of the nation which refers to n_name = 'EGYPT'; the balance is in debt if s_acctbal < 0;\nHow many suppliers from Egypt have a debit balance?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.s_suppkey) FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0 AND T2.n_name = 'EGYPT'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T1.s_suppkey) FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0 AND T2.n_name = 'EGYPT'", "index": 3191, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['EGYPT', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsuppliers refer to s_suppkey; Egypt is the name of the nation which refers to n_name = 'EGYPT'; the balance is in debt if s_acctbal < 0;\nHow many suppliers from Egypt have a debit balance?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-03-22', '1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_shipmode text, -- line item ship mode, example: ['REG AIR', 'SHIP', 'AIR', 'RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitems shipped by REG AIR refer to l_linenumber where l_shipmode = 'REG AIR'; ordered on March 22, 1995 refers to o_orderdate = '1995-03-22';\nHow many items shipped by REG AIR were ordered on March 22, 1995?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.o_orderkey) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T2.l_shipmode = 'REG AIR' AND T1.o_orderdate = '1995-03-22'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T1.o_orderkey) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T2.l_shipmode = 'REG AIR' AND T1.o_orderdate = '1995-03-22'", "index": 3192, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-03-22', '1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_shipmode text, -- line item ship mode, example: ['REG AIR', 'SHIP', 'AIR', 'RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitems shipped by REG AIR refer to l_linenumber where l_shipmode = 'REG AIR'; ordered on March 22, 1995 refers to o_orderdate = '1995-03-22';\nHow many items shipped by REG AIR were ordered on March 22, 1995?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['EUROPE', 'AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEuropean suppliers refer to s_suppkey where r_name = 'EUROPE';\nHow many European suppliers are there?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.n_nationkey) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey INNER JOIN supplier AS T3 ON T1.n_nationkey = T3.s_nationkey WHERE T2.r_name = 'EUROPE'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T1.n_nationkey) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey INNER JOIN supplier AS T3 ON T1.n_nationkey = T3.s_nationkey WHERE T2.r_name = 'EUROPE'", "index": 3193, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['EUROPE', 'AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEuropean suppliers refer to s_suppkey where r_name = 'EUROPE';\nHow many European suppliers are there?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsegment refers to c_mktsegment; customer made the most orders in April 1994 refers to c_custkey where o_orderdate LIKE '1994-04-%' and MAX(COUNT(o_orderkey));\nTo which segment belongs the customer that made the most orders in April 1994?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T.c_mktsegment FROM ( SELECT T2.c_mktsegment, COUNT(T1.o_orderkey) AS num FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T1.o_orderdate LIKE '1994-04-%' GROUP BY T1.o_custkey ) AS T ORDER BY T.num DESC LIMIT 1", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT T.c_mktsegment FROM ( SELECT T2.c_mktsegment, COUNT(T1.o_orderkey) AS num FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T1.o_orderdate LIKE '1994-04-%' GROUP BY T1.o_custkey ) AS T ORDER BY T.num DESC LIMIT 1", "index": 3194, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsegment refers to c_mktsegment; customer made the most orders in April 1994 refers to c_custkey where o_orderdate LIKE '1994-04-%' and MAX(COUNT(o_orderkey));\nTo which segment belongs the customer that made the most orders in April 1994?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['MOZAMBIQUE', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['5-LOW', '4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMozambique refers to n_name = 'MOZAMBIQUE'; low priority order refers to o_orderpriority = '5-LOW'\nHow many clients from Mozambique required orders with a low priority order?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey INNER JOIN orders AS T3 ON T1.c_custkey = T3.o_custkey WHERE T2.n_name = 'MOZAMBIQUE' AND T3.o_orderpriority = '5-LOW'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey INNER JOIN orders AS T3 ON T1.c_custkey = T3.o_custkey WHERE T2.n_name = 'MOZAMBIQUE' AND T3.o_orderpriority = '5-LOW'", "index": 3195, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['MOZAMBIQUE', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['5-LOW', '4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMozambique refers to n_name = 'MOZAMBIQUE'; low priority order refers to o_orderpriority = '5-LOW'\nHow many clients from Mozambique required orders with a low priority order?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['uFTe2u518et8Q8UC', 'KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nclerk who have served the customer refers to o_clerk\n\nHow many different clerks have served the customer with the address uFTe2u518et8Q8UC?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.o_clerk) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_address = 'uFTe2u518et8Q8UC'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T1.o_clerk) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_address = 'uFTe2u518et8Q8UC'", "index": 3196, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['uFTe2u518et8Q8UC', 'KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nclerk who have served the customer refers to o_clerk\n\nHow many different clerks have served the customer with the address uFTe2u518et8Q8UC?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['GERMANY', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGermany is nation name which refers to n_name = 'GERMANY'; comment with 'carefully regular packages' refers to s_comment LIKE 'carefully regular packages%'\nHow many suppliers from Germany have left a comment with 'carefully regular packages'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.s_suppkey) FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T2.n_name = 'GERMANY' AND T1.s_comment LIKE '%carefully regular packages%'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT COUNT(T1.s_suppkey) FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T2.n_name = 'GERMANY' AND T1.s_comment LIKE '%carefully regular packages%'", "index": 3197, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['GERMANY', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGermany is nation name which refers to n_name = 'GERMANY'; comment with 'carefully regular packages' refers to s_comment LIKE 'carefully regular packages%'\nHow many suppliers from Germany have left a comment with 'carefully regular packages'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['IRAN', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['HOUSEHOLD', 'BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe household segment refers to c_mktsegment = 'HOUSEHOLD'; Iran is nation name which refers to n_name = 'IRAN'; percentage = divide(count(c_custkey where n_name = 'IRAN'), count(c_custkey)) where c_mktsegment = 'HOUSEHOLD' * 100%\nWhat percentage of customers engaged in the household segment are from Iran?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.n_name = 'IRAN', 1, 0)) AS REAL) * 100 / COUNT(T2.n_name) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_mktsegment = 'HOUSEHOLD'", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T2.n_name = 'IRAN', 1, 0)) AS REAL) * 100 / COUNT(T2.n_name) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_mktsegment = 'HOUSEHOLD'", "index": 3198, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['IRAN', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['HOUSEHOLD', 'BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe household segment refers to c_mktsegment = 'HOUSEHOLD'; Iran is nation name which refers to n_name = 'IRAN'; percentage = divide(count(c_custkey where n_name = 'IRAN'), count(c_custkey)) where c_mktsegment = 'HOUSEHOLD' * 100%\nWhat percentage of customers engaged in the household segment are from Iran?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsegment refers to c_mktsegment; name refers to c_name; address refers to c_address; phone number refers to c_phone; customer number 3 refers to c_custkey = 3\nPlease state the segment, the name, the address, and the phone number of customer number 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 c_mktsegment, c_name, c_address, c_phone FROM customer WHERE c_custkey = 3", "style": "rule" }
{ "db_id": "retails.sqlite", "gt_sql": "SELECT c_mktsegment, c_name, c_address, c_phone FROM customer WHERE c_custkey = 3", "index": 3199, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsegment refers to c_mktsegment; name refers to c_name; address refers to c_address; phone number refers to c_phone; customer number 3 refers to c_custkey = 3\nPlease state the segment, the name, the address, and the phone number of customer number 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" }